@contember/typesafe
Advanced tools
Comparing version
@@ -143,3 +143,3 @@ "use strict"; | ||
const newPath = [...path, k]; | ||
if (!(k in input)) { | ||
if (!(k in input) || input[k] === undefined) { | ||
return []; | ||
@@ -345,11 +345,3 @@ } | ||
const type = (input, path = []) => { | ||
try { | ||
return inner(input, path); | ||
} | ||
catch (e) { | ||
if (e instanceof ParseError) | ||
return fallback; | ||
else | ||
throw e; | ||
} | ||
return inner(input !== null && input !== void 0 ? input : fallback, path); | ||
}; | ||
@@ -356,0 +348,0 @@ type.inner = inner; |
{ | ||
"name": "@contember/typesafe", | ||
"version": "1.4.0-beta.2", | ||
"version": "1.4.0-rc.1", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
@@ -165,3 +165,3 @@ type Unpacked<T> = T extends readonly (infer U)[] ? U : never | ||
const newPath = [...path, k] | ||
if (!(k in (input as object))) { | ||
if (!(k in (input as object)) || (input as any)[k] === undefined) { | ||
return [] | ||
@@ -391,8 +391,3 @@ } | ||
const type = (input: unknown, path: PropertyKey[] = []): T | F => { | ||
try { | ||
return inner(input, path) | ||
} catch (e) { | ||
if (e instanceof ParseError) return fallback | ||
else throw e | ||
} | ||
return inner(input ?? fallback, path) | ||
} | ||
@@ -399,0 +394,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
90436
-0.21%786
-1.63%