Typescript variables

From wikinotes
Revision as of 03:34, 11 December 2022 by Will (talk | contribs) (→‎Assignment)

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)

Scope