Open tom-sherman opened 2 weeks ago
I think changing the Omit to be an intersection with the property set to unknown could work here eg.
- Omit<InputSchema, "collection">
+ InputSchema & { collection?: unknown }
Hmm, the suggestion above doesn't work actually. Not sure what the workaround is then.
Basically have no other choice than removing the [x: string]: unknown
index signature from the InputSchema
interface.
Doing so causes a bunch of breaking changes though :/ (see related PR)
@matthieusieben looks like there's a solution in #2968 🙌
Describe the bug
Methods like
create
that accept anInputSchema
lose their type safety and accept any object value.To Reproduce
Steps to reproduce the behavior:
Expected behavior
Type errors should happen above. See playground.
Details
This is caused by the use of
Omit
on a type with an index signature. This is expected behaviour of typescript see https://github.com/microsoft/TypeScript/issues/45367Additional context