From a523784388a79ce65e42caf4d2731da36a94b386 Mon Sep 17 00:00:00 2001 From: Jason Ian Green Date: Wed, 10 Jul 2024 08:55:28 +0100 Subject: [PATCH] fix: changes for @typescript-eslint/array-type rule (#2467) --- 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 }