ts-auto-mock icon indicating copy to clipboard operation
ts-auto-mock copied to clipboard

Using Omit with createMock returns undefined

Open guidiamond opened this issue 4 years ago • 1 comments

Bug: Using Omit with interface when calling createMock returns undefined

If you try to use Omit with an interface when calling createMock it returns undefined.

Your environment

  • ts-auto-mock version: 3.5.0
  • typescript version: 4.1.3
  • node version: 14.17.3
  • yarn version: 1.22.11

Steps to reproduce

interface Person {
  name: string;
  password: string;
}

const personWithoutName = createMock<Omit<Person,"name">>();
console.log(personWithoutName); // Returns undefined

Expected behavior

interface Person {
  name: string;
  password: string;
}

const personWithoutName = createMock<Omit<Person,"name">>();
console.log(personWithoutName); // { password: "" }

guidiamond avatar Oct 22 '21 15:10 guidiamond

@guidiamond hi!!!

I think this is related to another issue where we dont support mapped types. I may give it another go to see if we can fix it, but I can't promise when.

I am wondering if there is anything else you could use while waiting for the fix. @Pmyl sorry for throwing you in the mix, do you have any ideas?

Thank you!

uittorio avatar Oct 22 '21 16:10 uittorio