mswjs / data

Data modeling and relation library for testing JavaScript applications.
https://npm.im/@mswjs/data
MIT License
823 stars 52 forks source link

fix(oneOf): identify Nullable type returned from oneOf method #238

Open themagickoala opened 2 years ago

themagickoala commented 2 years ago

This PR is incomplete, as the ts-expect-error tests are failing in one-to-one test files for create and update. My intention here is for the return value of oneOf to default to OneOf<ModelType, false>, and to be OneOf<ModelType, true> if you pass { nullable: true }. However, the types I've added seem to not be specific enough, as the default is just OneOf<ModelType, boolean> whatever you set. @kettanaito are you able to provide some guidance? If not, I'll try and come back to this another time!