Skip to content

Commit a523784

Browse files
fix: changes for @typescript-eslint/array-type rule (#2467)
1 parent 595fe58 commit a523784

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/types/json-schema.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,25 @@ type UncheckedJSONSchemaType<T, IsPartial extends boolean> = (
108108
: UncheckedPropertiesSchema<T>
109109
patternProperties?: Record<string, UncheckedJSONSchemaType<T[string], false>>
110110
propertyNames?: Omit<UncheckedJSONSchemaType<string, false>, "type"> & {type?: "string"}
111-
dependencies?: {[K in keyof T]?: Readonly<(keyof T)[]> | UncheckedPartialSchema<T>}
112-
dependentRequired?: {[K in keyof T]?: Readonly<(keyof T)[]>}
111+
dependencies?: {[K in keyof T]?: readonly (keyof T)[] | UncheckedPartialSchema<T>}
112+
dependentRequired?: {[K in keyof T]?: readonly (keyof T)[]}
113113
dependentSchemas?: {[K in keyof T]?: UncheckedPartialSchema<T>}
114114
minProperties?: number
115115
maxProperties?: number
116116
} & (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
117-
? {required: Readonly<(keyof T)[]>}
117+
? {required: readonly (keyof T)[]}
118118
: [UncheckedRequiredMembers<T>] extends [never]
119-
? {required?: Readonly<UncheckedRequiredMembers<T>[]>}
120-
: {required: Readonly<UncheckedRequiredMembers<T>[]>})
119+
? {required?: readonly UncheckedRequiredMembers<T>[]}
120+
: {required: readonly UncheckedRequiredMembers<T>[]})
121121
: T extends null
122122
? {
123123
type: JSONType<"null", IsPartial>
124124
nullable: true
125125
}
126126
: never) & {
127-
allOf?: Readonly<UncheckedPartialSchema<T>[]>
128-
anyOf?: Readonly<UncheckedPartialSchema<T>[]>
129-
oneOf?: Readonly<UncheckedPartialSchema<T>[]>
127+
allOf?: readonly UncheckedPartialSchema<T>[]
128+
anyOf?: readonly UncheckedPartialSchema<T>[]
129+
oneOf?: readonly UncheckedPartialSchema<T>[]
130130
if?: UncheckedPartialSchema<T>
131131
then?: UncheckedPartialSchema<T>
132132
else?: UncheckedPartialSchema<T>
@@ -176,12 +176,12 @@ type Nullable<T> = undefined extends T
176176
? {
177177
nullable: true
178178
const?: null // any non-null value would fail `const: null`, `null` would fail any other value in const
179-
enum?: Readonly<(T | null)[]> // `null` must be explicitly included in "enum" for `null` to pass
179+
enum?: readonly (T | null)[] // `null` must be explicitly included in "enum" for `null` to pass
180180
default?: T | null
181181
}
182182
: {
183183
nullable?: false
184184
const?: T
185-
enum?: Readonly<T[]>
185+
enum?: readonly T[]
186186
default?: T
187187
}

0 commit comments

Comments
 (0)