Syntax
TypeScript Annotate a Variable Type Syntax
In TypeScript, annotate a variable type: declares the type of a variable — let name: string = "Ada";
Quick Answer
- Syntax
let name: string = "Ada";
TypeScriptSyntax
Annotate a Variable Type
Code example
let name: string = "Ada";
Declares the type of a variable.
How to annotate a variable type in TypeScript
- Open your TypeScript file or editor.
- Copy the example, then replace its sample names and values for your code.
TypeScript Annotate a Variable Type Syntax
Use let name: string = "Ada";.
Related Syntax References
Frequently asked questions
What is the TypeScript syntax for annotate a variable type?
Use this pattern: let name: string = "Ada";
Can I copy this TypeScript code example?
Yes. Use Copy code and adapt the example to your program.
Is this TypeScript syntax different on Mac or Windows?
No. The language syntax is the same across operating systems.
Official source · How we verify