type-fns
Version:
A set of types, type checks, and type guards for simpler, safer, and easier to read code.
36 lines • 930 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
describe('PickAny', () => {
it('should constrain type correctly', async () => {
const findFlowers = async (input) => {
// ...
};
// you can find by color
await findFlowers({
color: {
petals: 'white',
},
});
// you can find by size
await findFlowers({
size: {
choice: 'LARGE',
},
});
// you can find by both
await findFlowers({
color: {
petals: 'white',
},
size: {
choice: 'LARGE',
},
});
// you can't find by neither
await findFlowers({
// @ts-expect-error - cant be neither
size: {},
});
});
});
//# sourceMappingURL=PickAny.test.js.map