Created
August 29, 2020 11:06
-
-
Save y21/3e67e4f71b8b99d684f86e4af2a363ab 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
type Value = string | number; | |
type Indexable<V> = { [key: string]: V }; | |
function makeTypedNullPrototype<T = any, V = Value>(obj: T): T & Indexable<V> { | |
return Object.setPrototypeOf(obj, null); | |
} | |
// const p = makeTypedNullPrototype({ | |
// a: 3 | |
// }); | |
// console.log( | |
// p[prompt()!] | |
// ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment