Skip to content

Instantly share code, notes, and snippets.

@eamonnboyle
Created August 27, 2021 10:13
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 eamonnboyle/b925702a03a22670cc48abf58c02a875 to your computer and use it in GitHub Desktop.
Save eamonnboyle/b925702a03a22670cc48abf58c02a875 to your computer and use it in GitHub Desktop.
TS 4.4 - Aliased Condition
const isTextArea = 'rows' in input;
if (isTextArea) {
// Narrowing has NOT taken place
input.rows = 25; // Compiler error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment