3 ms·
So much better than the workaround here: https://github.com/Microsoft/TypeScript/issues/3960#issuecomment-301381447 https://github.com/Microsoft/TypeScript/issu
by btown 8y ago
So much better than the workaround here: https://github.com/Microsoft/TypeScript/issues/3960#issuecomment-301381447 https://github.com/Microsoft/TypeScript/issues/3960#issuecom...
type TemplateTypedSelect = new () => Select<Template>;
const TemplateTypedSelect = Select as TemplateTypedSelect;
return <TemplateTypedSelect {...props} />;
Our codebase was sprinkled with these, which was both silly and error-prone. This will be a huge quality-of-life improvement, and encourage people to create type-safe React components that ensure a match between their inputs and callbacks, rather than just having them put a union of all the types they can handle in both.