Open hosswald opened 1 year ago
Hi @hosswald
Instead of using any could you try using
createHydratedMock<{bar?: string}>() as Required<{bar?: string}
This should prevent you casting to any.
In response of what it should return createHydratedMock.
Required would be slightly incorrect because it doesn't consider nested properties in the object, just the first level.
The purpose of ts-auto-mock was not changing the original type but mutating values. I understand where you are coming from and it something that we could have discuss further if we were actively maintaining the library!!
Happy to see a PR with a proposal!
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
Expected behavior
Actual behavior