Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const typedPrimitive = (I: Function) => (i: undefined) => {
const derived = Object(i);
Object.setPrototypeOf(derived, Object(i));
const typeProperty = {
enumerable: false,
configurable: false,
writable: false,
value: I
};
Object.defineProperty(derived, String(I), typeProperty);
return <undefined>derived;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment