Skip to content

Instantly share code, notes, and snippets.

@ZacharyL2
Created April 4, 2022 10:59
Show Gist options
  • Save ZacharyL2/dcc88006792bf0c66b0b998d69fdc9bf to your computer and use it in GitHub Desktop.
Save ZacharyL2/dcc88006792bf0c66b0b998d69fdc9bf to your computer and use it in GitHub Desktop.
{
// ✨ In intersection types, all types will absorb `unknown`.
type T1 = unknown & null; // null
type T2 = unknown & number; // number
type T3 = unknown & never; // never
type T4 = unknown & unknown; // unknown
type T5<T> = T & unknown; // T
type T6 = unknown & any; // any
// never (`null & undefined` will become never)
type T7 = unknown & null & undefined;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment