Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions typescript/packages/common-builder/src/schema-to-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export type Schema<
T extends
{ additionalProperties: infer AP extends boolean | JSONSchema }
? AP
: true,
: false,
GetDefaultKeys<T>
>
: Record<string, unknown>
Expand Down Expand Up @@ -122,7 +122,9 @@ type ObjectFromProperties<
}
// Additional properties
& (
AP extends false ? Record<string | number | symbol, never>
AP extends false
// Additional properties off => no-op instead of empty record
? Record<never, never>
: AP extends true ? { [key: string]: unknown }
: AP extends JSONSchema
? { [key: string]: Schema<AP, Root, DecrementDepth<Depth>> }
Expand Down Expand Up @@ -206,7 +208,7 @@ export type SchemaWithoutCell<
T extends
{ additionalProperties: infer AP extends boolean | JSONSchema }
? AP
: true,
: false,
GetDefaultKeys<T>
>
: Record<string, unknown>
Expand Down Expand Up @@ -271,8 +273,8 @@ type ObjectFromPropertiesWithoutCell<
// Additional properties
& (
AP extends false
// Additional properties off => empty
? Record<string | number | symbol, never>
// Additional properties off => no-op instead of empty record
? Record<never, never>
: AP extends true
// Additional properties on => unknown
? { [key: string]: unknown }
Expand Down