Skip to content

Commit

Permalink
Revert Never Assertion on Definition Key Indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
sinclairzx81 committed Nov 16, 2024
1 parent 5241fc6 commit 83979c4
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/compiler/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export namespace TypeCompiler {
}
function* FromImport(schema: TImport, references: TSchema[], value: string): IterableIterator<string> {
const definitions = globalThis.Object.values(schema.$defs) as TSchema[]
const target = schema.$defs[schema.$ref as never] as TSchema
const target = schema.$defs[schema.$ref] as TSchema
yield* Visit(target, [...references, ...definitions], value)
}
function* FromInteger(schema: TInteger, references: TSchema[], value: string): IterableIterator<string> {
Expand Down
2 changes: 1 addition & 1 deletion src/errors/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ function* FromFunction(schema: TFunction, references: TSchema[], path: string, v
}
function* FromImport(schema: TImport, references: TSchema[], path: string, value: any): IterableIterator<ValueError> {
const definitions = globalThis.Object.values(schema.$defs) as TSchema[]
const target = schema.$defs[schema.$ref as never] as TSchema
const target = schema.$defs[schema.$ref] as TSchema
yield* Visit(target, [...references, ...definitions], path, value)
}
function* FromInteger(schema: TInteger, references: TSchema[], path: string, value: any): IterableIterator<ValueError> {
Expand Down
2 changes: 1 addition & 1 deletion src/value/cast/cast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function FromConstructor(schema: TConstructor, references: TSchema[], value: any
}
function FromImport(schema: TImport, references: TSchema[], value: unknown): boolean {
const definitions = globalThis.Object.values(schema.$defs) as TSchema[]
const target = schema.$defs[schema.$ref as never] as TSchema
const target = schema.$defs[schema.$ref] as TSchema
return Visit(target, [...references, ...definitions], value)
}
function FromIntersect(schema: TIntersect, references: TSchema[], value: any): any {
Expand Down
2 changes: 1 addition & 1 deletion src/value/check/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function FromFunction(schema: TFunction, references: TSchema[], value: any): boo
}
function FromImport(schema: TImport, references: TSchema[], value: any): boolean {
const definitions = globalThis.Object.values(schema.$defs) as TSchema[]
const target = schema.$defs[schema.$ref as never] as TSchema
const target = schema.$defs[schema.$ref] as TSchema
return Visit(target, [...references, ...definitions], value)
}
function FromInteger(schema: TInteger, references: TSchema[], value: any): boolean {
Expand Down
2 changes: 1 addition & 1 deletion src/value/clean/clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function FromArray(schema: TArray, references: TSchema[], value: unknown): any {
}
function FromImport(schema: TImport, references: TSchema[], value: unknown): any {
const definitions = globalThis.Object.values(schema.$defs) as TSchema[]
const target = schema.$defs[schema.$ref as never] as TSchema
const target = schema.$defs[schema.$ref] as TSchema
return Visit(target, [...references, ...definitions], value)
}
function FromIntersect(schema: TIntersect, references: TSchema[], value: unknown): any {
Expand Down
2 changes: 1 addition & 1 deletion src/value/convert/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function FromDate(schema: TDate, references: TSchema[], value: any): unknown {
}
function FromImport(schema: TImport, references: TSchema[], value: unknown): unknown {
const definitions = globalThis.Object.values(schema.$defs) as TSchema[]
const target = schema.$defs[schema.$ref as never] as TSchema
const target = schema.$defs[schema.$ref] as TSchema
return Visit(target, [...references, ...definitions], value)
}
function FromInteger(schema: TInteger, references: TSchema[], value: any): unknown {
Expand Down
2 changes: 1 addition & 1 deletion src/value/create/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function FromFunction(schema: TFunction, references: TSchema[]): any {
}
function FromImport(schema: TImport, references: TSchema[]): any {
const definitions = globalThis.Object.values(schema.$defs) as TSchema[]
const target = schema.$defs[schema.$ref as never] as TSchema
const target = schema.$defs[schema.$ref] as TSchema
return Visit(target, [...references, ...definitions])
}
function FromInteger(schema: TInteger, references: TSchema[]): any {
Expand Down
2 changes: 1 addition & 1 deletion src/value/default/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function FromDate(schema: TArray, references: TSchema[], value: unknown): any {
}
function FromImport(schema: TImport, references: TSchema[], value: unknown): any {
const definitions = globalThis.Object.values(schema.$defs) as TSchema[]
const target = schema.$defs[schema.$ref as never] as TSchema
const target = schema.$defs[schema.$ref] as TSchema
return Visit(target, [...references, ...definitions], value)
}
function FromIntersect(schema: TIntersect, references: TSchema[], value: unknown): any {
Expand Down
2 changes: 1 addition & 1 deletion src/value/transform/decode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function FromIntersect(schema: TIntersect, references: TSchema[], path: string,
// prettier-ignore
function FromImport(schema: TImport, references: TSchema[], path: string, value: unknown): unknown {
const definitions = globalThis.Object.values(schema.$defs) as TSchema[]
const target = schema.$defs[schema.$ref as never] as TSchema
const target = schema.$defs[schema.$ref] as TSchema
const transform = schema[TransformKind as never]
// Note: we need to re-spec the target as TSchema + [TransformKind]
const transformTarget = { [TransformKind]: transform, ...target } as TSchema
Expand Down
2 changes: 1 addition & 1 deletion src/value/transform/encode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function FromArray(schema: TArray, references: TSchema[], path: string, value: a
// prettier-ignore
function FromImport(schema: TImport, references: TSchema[], path: string, value: unknown): unknown {
const definitions = globalThis.Object.values(schema.$defs) as TSchema[]
const target = schema.$defs[schema.$ref as never] as TSchema
const target = schema.$defs[schema.$ref] as TSchema
const transform = schema[TransformKind as never]
// Note: we need to re-spec the target as TSchema + [TransformKind]
const transformTarget = { [TransformKind]: transform, ...target } as TSchema
Expand Down

0 comments on commit 83979c4

Please sign in to comment.