Skip to content

Commit e358f7e

Browse files
committed
fix: Don't skip required undefined properties on object
1 parent db01e35 commit e358f7e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/value/default/from-object.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ THE SOFTWARE.
3131

3232
import type { TProperties, TObject } from '../../type/index.ts'
3333
import { Guard } from '../../guard/index.ts'
34-
import { FromDefault } from './from-default.ts'
3534
import { FromType } from './from-type.ts'
3635

3736
import { IsAdditionalProperties } from '../../schema/types/index.ts'
@@ -46,7 +45,7 @@ export function FromObject(context: TProperties, type: TObject, value: unknown):
4645
// yielded a non undefined result. Here we interpret an undefined result as
4746
// a non assignable property and continue.
4847
const propertyValue = FromType(context, type.properties[key], value[key])
49-
if (Guard.IsUndefined(propertyValue)) continue
48+
if (Guard.IsUndefined(propertyValue) && !type.required.includes(key)) continue
5049
value[key] = FromType(context, type.properties[key], value[key])
5150
}
5251
// return if not additional properties

0 commit comments

Comments
 (0)