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
The inferred type of the generator allows for extra properties(variant 1).
In the case of class extension it also requires narrowing the literal types(variant 3).
It seems to work well when the return type is set explicitly(variant 2, variant 4).
Looking at the source code(the generic types), I would expect the generator return type to be inferred properly 🤔
I don't know why Typescript requires you to narrow your type (status: 'published' as const) for the class extension but not the factory. They're both using the same define function internally. Probably because the Factory type definition (Factory<Post>) happens a little bit further away from the function definition. I'm not sure what we could do for a fix there.
Description
The inferred type of the generator allows for extra properties(variant 1).
In the case of class extension it also requires narrowing the literal types(variant 3).
It seems to work well when the return type is set explicitly(variant 2, variant 4).
Looking at the source code(the generic types), I would expect the generator return type to be inferred properly 🤔
I'm not sure if this is a bug or a feature 😄
To Reproduce
https://stackblitz.com/edit/fishery-test?file=Post.ts
Additional context
Fishery version: 2.2.2
The text was updated successfully, but these errors were encountered: