What TypeScript is
suggest changeTypeScript adds static type checking to JavaScript. Type annotations are checked during development and erased from emitted JavaScript; inferred types do not change how values behave at runtime. Some TypeScript syntax, such as enums and parameter properties, does emit JavaScript.
Type inference means annotations are most useful at API boundaries. Local values often need no explicit type.
const language = "TypeScript";
function greeting(name: string): string {
return `Hello, ${name}!`;
}
const message = greeting(language);
console.log(message);
Type checking does not validate data received at runtime. Parse and validate input from files, users, and network requests before treating it as a trusted type.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents