Typescript variables: Difference between revisions

From wikinotes
No edit summary
 
Line 1: Line 1:
{{ NOTE |
see also [[javascript variables]] }}
= Assignment =
= Assignment =
<blockquote>
<blockquote>
Line 7: Line 10:
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- Assignment -->
</blockquote><!-- Assignment -->
= Scope =
<blockquote>
</blockquote><!-- Scope -->

Latest revision as of 00:41, 17 December 2022

NOTE:

see also javascript variables

Assignment

let name: string = "alex";   // type annotation
let name = "alex";           // inferred type 'string'
let foo = bar.baz() as User; // type assertion (I know this is a user, but compiler won't)