Created
April 6, 2018 14:47
-
-
Save ajcrites/50343c8e264320c36f0eebb049616fa9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
interface KeyVal { | |
customerID: string; | |
isLoggedIn: boolean; | |
count: number; | |
} | |
const sensi = <T extends keyof KeyVal>(key: T, value: KeyVal[T]) => { | |
}; | |
sensi('customerID', 'str'); | |
sensi('customerId', 'str'); | |
sensi('isLoggedIn', 'str'); | |
sensi('isLoggedIn', true); | |
sensi('count', true); | |
sensi('count', 1); | |
sensi('foober', null); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment