@@ -28,20 +28,21 @@ THE SOFTWARE.
2828
2929// deno-fmt-ignore-file
3030
31- import { type TProperties , type TSchema , type TIntersect , Evaluate , IsObject , Options } from '../../type/index.ts'
31+ import { type TProperties , type TSchema , type TIntersect , Evaluate , Instantiate , IsObject , Options } from '../../type/index.ts'
3232import { Guard } from '../../guard/index.ts'
3333import { FromType } from './from-type.ts'
3434
3535// ------------------------------------------------------------------
3636// EvaluateIntersection
3737// ------------------------------------------------------------------
38- function EvaluateIntersection ( type : TIntersect ) : TSchema {
38+ function EvaluateIntersection ( context : TProperties , type : TIntersect ) : TSchema {
3939 // Note: reinterpret unevaluatedProperties as additionalProperties
4040 const additionalProperties =
4141 Guard . HasPropertyKey ( type , 'unevaluatedProperties' )
4242 ? { additionalProperties : type . unevaluatedProperties }
4343 : { }
44- const evaluated = Evaluate ( type )
44+ const instantiated = Instantiate ( context , type )
45+ const evaluated = Evaluate ( instantiated )
4546 return IsObject ( evaluated )
4647 ? Options ( evaluated , additionalProperties )
4748 : evaluated
@@ -51,7 +52,7 @@ function EvaluateIntersection(type: TIntersect): TSchema {
5152// ------------------------------------------------------------------
5253export function FromIntersect ( context : TProperties , type : TIntersect , value : unknown ) : unknown {
5354 // Note: Evaluate and route back to FromType in evaluated form (likely an Object)
54- const evaluated = EvaluateIntersection ( type )
55+ const evaluated = EvaluateIntersection ( context , type )
5556 return FromType ( context , evaluated , value )
5657}
5758
0 commit comments