Skip to content

Instantly share code, notes, and snippets.

@prashaantt
Created December 2, 2016 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prashaantt/396b7d929332a8d7535ed1b0e437e13d to your computer and use it in GitHub Desktop.
Save prashaantt/396b7d929332a8d7535ed1b0e437e13d to your computer and use it in GitHub Desktop.
let s1: string;
s1 = "some string";
s1 = undefined; // Type 'undefined' is not assignable to type 'string'
s1 = null; // Type 'null' is not assignable to type 'string'
let s2: string | undefined;
s2 = "another string";
s2 = undefined;
s2 = null; // Type 'null' is not assignable to type 'string | undefined'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment