-
Notifications
You must be signed in to change notification settings - Fork 12
ObjectOmit
narrows any
type to {}
#19
Comments
hm. when removing string-based keys, doesn't it make sense that the output would be some kind of object? |
I'm not sure 🤔 For context, this behaviour is causing issues for me when I'm trying to use the class Foo extends React.Component<any> {}
const DefaultedFoo = withDefaults(Foo, { baz: 1 });
// Unexpected error: Property 'bar' does not exist on type 'IntrinsicAttributes & Pick<any, never> & Partial<{ baz: number; }> & { children?: ReactNode; }'.
<DefaultedFoo bar="foo" />; This is because Although I am able to workaround the issue by widening the default props object to type Props = any;
class Foo extends React.Component<Props> {}
const defaults: Props = { baz: 1 }
const DefaultedFoo = withDefaults(Foo, defaults);
<DefaultedFoo bar="foo" />; |
Makes sense. |
I think design decisions in typescript made a turn for the worse :( |
Would Conditional Types - microsoft/TypeScript#21316 - help here? |
@IanYates Maybe! Could we do something like |
I fear all types would extend |
Is there any way around this?
The text was updated successfully, but these errors were encountered: