Open marwankhalili opened 4 years ago
This is a problem e.g. when passing a function to the items option:
items
expect( { users: { type: "array", items: (user: { isLoggedIn: boolean }) => ({ type: "object", keys: user.isLoggedIn ? { username: "string", password: "string", isLoggedIn: { type: "boolean", allowNull: true }, } : { temporaryUuid: "string", isLoggedIn: { type: "boolean", allowNull: true }, }, }), }, }, { users: [ { isLoggedIn: true, username: "John", password: "Snow" }, { isLoggedIn: false, temporaryUuid: '123' }, ], } ).getParsed(); // { users?: { isLoggedIn: boolean | "" | null | undefined; }[] | undefined } } /* getParsed() should return the following type { users?: | { username: string; password: string; isLoggedIn: boolean | undefined | null; }[] | { temporaryUuid: string; isLoggedIn: boolean | undefined | null; }[] } */
The type inference used by errors() has the same issue
errors()
This is a problem e.g. when passing a function to the
items
option: