Skip to content

Commit

Permalink
Update Compiler FromImport Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
sinclairzx81 committed Dec 5, 2024
1 parent 942940e commit f0e7aa7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/compiler/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import type { TNumber } from '../type/number/index'
import type { TObject } from '../type/object/index'
import type { TPromise } from '../type/promise/index'
import type { TRecord } from '../type/record/index'
import type { TRef } from '../type/ref/index'
import { Ref, type TRef } from '../type/ref/index'
import type { TRegExp } from '../type/regexp/index'
import type { TTemplateLiteral } from '../type/template-literal/index'
import type { TThis } from '../type/recursive/index'
Expand Down Expand Up @@ -298,11 +298,11 @@ export namespace TypeCompiler {
yield `(typeof ${value} === 'function')`
}
function* FromImport(schema: TImport, references: TSchema[], value: string): IterableIterator<string> {
const interior = globalThis.Object.getOwnPropertyNames(schema.$defs).reduce((result, key) => {
const members = globalThis.Object.getOwnPropertyNames(schema.$defs).reduce((result, key) => {
return [...result, schema.$defs[key as never] as TSchema]
}, [] as TSchema[])
const target = { [Kind]: 'Ref', $ref: schema.$ref } as never
yield* Visit(target, [...references, ...interior], value)
const ref = Ref(schema.$ref)
yield* Visit(ref, [...references, ...members], value)
}
function* FromInteger(schema: TInteger, references: TSchema[], value: string): IterableIterator<string> {
yield `Number.isInteger(${value})`
Expand Down

0 comments on commit f0e7aa7

Please sign in to comment.