From 80d4033bf24d40799403a4487e20326a12b582e7 Mon Sep 17 00:00:00 2001 From: Jason Green Date: Sun, 7 Jul 2024 23:35:11 +0100 Subject: [PATCH] fix: changes for @typescript-eslint/array-type rule --- lib/types/json-schema.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/types/json-schema.ts b/lib/types/json-schema.ts index 281a38bdb..065c972e5 100644 --- a/lib/types/json-schema.ts +++ b/lib/types/json-schema.ts @@ -108,25 +108,25 @@ type UncheckedJSONSchemaType = ( : UncheckedPropertiesSchema patternProperties?: Record> propertyNames?: Omit, "type"> & {type?: "string"} - dependencies?: {[K in keyof T]?: Readonly<(keyof T)[]> | UncheckedPartialSchema} - dependentRequired?: {[K in keyof T]?: Readonly<(keyof T)[]>} + dependencies?: {[K in keyof T]?: readonly (keyof T)[] | UncheckedPartialSchema} + dependentRequired?: {[K in keyof T]?: readonly (keyof T)[]} dependentSchemas?: {[K in keyof T]?: UncheckedPartialSchema} minProperties?: number maxProperties?: number } & (IsPartial extends true // "required" is not necessary if it's a non-partial type with no required keys // are listed it only asserts that optional cannot be listed. // "required" type does not guarantee that all required properties - ? {required: Readonly<(keyof T)[]>} + ? {required: readonly (keyof T)[]} : [UncheckedRequiredMembers] extends [never] - ? {required?: Readonly[]>} - : {required: Readonly[]>}) + ? {required?: readonly UncheckedRequiredMembers[]} + : {required: readonly UncheckedRequiredMembers[]}) : T extends null ? { type: JSONType<"null", IsPartial> nullable: true } : never) & { - allOf?: Readonly[]> - anyOf?: Readonly[]> - oneOf?: Readonly[]> + allOf?: readonly UncheckedPartialSchema[] + anyOf?: readonly UncheckedPartialSchema[] + oneOf?: readonly UncheckedPartialSchema[] if?: UncheckedPartialSchema then?: UncheckedPartialSchema else?: UncheckedPartialSchema @@ -176,12 +176,12 @@ type Nullable = undefined extends T ? { nullable: true const?: null // any non-null value would fail `const: null`, `null` would fail any other value in const - enum?: Readonly<(T | null)[]> // `null` must be explicitly included in "enum" for `null` to pass + enum?: readonly (T | null)[] // `null` must be explicitly included in "enum" for `null` to pass default?: T | null } : { nullable?: false const?: T - enum?: Readonly + enum?: readonly T[] default?: T }