Skip to content

Instantly share code, notes, and snippets.

@michaeljscript
Created March 15, 2019 13:23
Show Gist options
  • Save michaeljscript/9dcd7925eaa8894d6dc716d5176c21e9 to your computer and use it in GitHub Desktop.
Save michaeljscript/9dcd7925eaa8894d6dc716d5176c21e9 to your computer and use it in GitHub Desktop.
function checkType<T>(value: unknown, parse: (val: unknown) => T | null): value is T {
return parse(value) !== null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment