Created
November 30, 2018 10:09
-
-
Save lumie1337/67f2473c94111ff683f3028bbe7006b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let my_number_var: number; | |
function ffi(var_from_js: unknown) { | |
// forces you to do this | |
if(typeof var_from_js === "number") | |
my_number_var = var_from_js | |
else | |
throw new Error("invalid use of api") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(T & unknown) is always a subtype of T, because (A & B) extends A holds
(T | unknown) can always be understood to be unknown, thereby rendering the T meaningless; because A extends (A | B) holds