Created
May 5, 2021 17:15
-
-
Save mfbx9da4/92e8cd311f07bc3afdf58f228710aca5 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
class Foo { | |
public a string | |
public b number | |
} | |
function getDefault(fieldAsString: 'a' | 'b') { | |
if (field === 'a') return 'asdf' | |
if (field === 'b') return 3 | |
} | |
const ret = getDefault('a') // returns string | |
const ret = getDefault('b') // returns number |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment