You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type '() => { versionNumber: number; }' is not assignable to type 'ModelDefinitionValue'.
Type '() => { versionNumber: number; }' is not assignable to type 'ModelValueTypeGetter'.
Type '{ versionNumber: number; }' is not assignable to type 'ModelValueType'.ts(2322)
glossary.d.ts(28, 65): The expected type comes from property 'metadata' which is declared here on type 'Limit<ModelDefinition>'
The only way I can seem to get around this is by doing the as unknown as any typecast for this nested value. I couldn't find any documentation around nested structures in the how to do typescript docs.
Is this the only supported way to do nested values for msw/data objects using typescript?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello! Thanks for this amazing project. I love
mswjs
and@msw/data
I am trying to define a factory with nested structures, as follows:
I did this according to this guidance in the msw/data docs.. However, this is causing typescript errors, namely:
The only way I can seem to get around this is by doing the
as unknown as any
typecast for this nested value. I couldn't find any documentation around nested structures in the how to do typescript docs.Is this the only supported way to do nested values for msw/data objects using typescript?
Beta Was this translation helpful? Give feedback.
All reactions