Skip to content

Instantly share code, notes, and snippets.

@achmedzhanov
Created March 12, 2019 13:38
Show Gist options
  • Save achmedzhanov/e269569712b4764b33cb6598e87cefb9 to your computer and use it in GitHub Desktop.
Save achmedzhanov/e269569712b4764b33cb6598e87cefb9 to your computer and use it in GitHub Desktop.
Not null type for Typ[eScript 3.4
type NotNull<T extends any | null> = T extends infer U | null ? U : T;
type t1 = NotNull<string>;
type t2 = NotNull<string|null>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment