-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Hello,
I'm trying to combine factories for an interface that has an optional field and I'm running into a typescript error.
Using the following example:
const softDelete = Sync.makeFactory({
isDeleted: false,
})
interface Post {
content?: string
isDeleted: boolean
}
const postFactory: Sync.Factory<Post> = Sync.makeFactory({
content: 'lorem ipsum',
}).combine(softDelete)
TS compilation results in:
TS2322: Type 'Factory<{ content: string; } & { isDeleted: boolean; }, "isDeleted" | "content">' is not assignable to type 'Factory<Post, keyof Post>'.
The types of 'builder.isDeleted' are incompatible between these types.
Type 'boolean | Generator<boolean> | Derived<{ content: string; } & { isDeleted: boolean; }, boolean>' is not assignable to type 'boolean | Generator<boolean> | Derived<Post, boolean>'.
Type 'Derived<{ content: string; } & { isDeleted: boolean; }, boolean>' is not assignable to type 'boolean | Generator<boolean> | Derived<Post, boolean>'.
Type 'Derived<{ content: string; } & { isDeleted: boolean; }, boolean>' is not assignable to type 'Derived<Post, boolean>'.
Type 'Post' is not assignable to type '{ content: string; } & { isDeleted: boolean; }'.
Am I missing something or is this a bug?
thenbe and Pandishpan
Metadata
Metadata
Assignees
Labels
No labels