Created
March 23, 2017 15:27
-
-
Save doug/f447aa01fddc19a415aa740a7304ddd1 to your computer and use it in GitHub Desktop.
Dynamically get the type of a deeply nested function in typescript.
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
function myfunc(): number { | |
return 42; | |
} | |
const tmp = (false as true) && myfunc(); | |
type MyType = typeof tmp; // MyType is correctly number |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment