Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Created April 6, 2018 14:47
Show Gist options
  • Save ajcrites/50343c8e264320c36f0eebb049616fa9 to your computer and use it in GitHub Desktop.
Save ajcrites/50343c8e264320c36f0eebb049616fa9 to your computer and use it in GitHub Desktop.
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