marchaos / jest-mock-extended

Type safe mocking extensions for Jest https://www.npmjs.com/package/jest-mock-extended
MIT License
810 stars 56 forks source link

Omit issue #92

Closed ayuka-bg closed 2 years ago

ayuka-bg commented 2 years ago

If i have something like this

interface ITestA { 
   foo: string,
   bar: string,
}
type ITestB = Omit<ITestA, 'foo'>

const bMock = mock<ITestB>();

bMock.foo still exist, but TS said there no foo property

is it TS behavior or just bug?

lallenfrancisl commented 2 years ago

This is the correct behavior, when you use Omit you are essentially telling typescript to ignore that field

marchaos commented 2 years ago

not seeing that as an issue:

image