Open
Description
Subject of the issue
createHydratedMock() mocks optional properties. The typescript compiler should know about that to avoid having to write unnecessary as any
in tests.
Your environment
- ts-auto-mock version: 3.7.1
- typescript version: 5.1.6
- node version: 20.5.0
- npm version: 9.8.1
Expected behavior
const foo = createHydratedMock<{bar?: string}>() // typeof foo == Required<{bar?: string} == {bar: string}
const baz: string = foo.bar
Actual behavior
const foo = createHydratedMock<{bar?: string}>()
const baz: string = foo.bar // TS2322: Type 'string | undefined' is not assignable to type 'string'.
Metadata
Metadata
Assignees
Labels
No labels