diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 88fca9e..ec80339 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -254,5 +254,13 @@ export function filterValid( return []; } - return source.filter((current) => isValid(current, schema)); + return source.reduce((acc, current) => { + const validation = getValidated(current, schema); + + if (!validation) { + return acc; + } + + return [...acc, validation]; + }, []); }