Skip to content

Instantly share code, notes, and snippets.

@adrianfaciu
Created February 23, 2018 09:18
Show Gist options
  • Save adrianfaciu/e811c2d84ba8791bba0e06b7f0b0638f to your computer and use it in GitHub Desktop.
Save adrianfaciu/e811c2d84ba8791bba0e06b7f0b0638f to your computer and use it in GitHub Desktop.
class Point {
constructor(public point: number) {}
}
function creator<T, G>(type: { new (args: G): T }) {
return (args: G) => new type(args);
}
[1, 2, 3].map(creator(Point));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment