Skip to content

Commit

Permalink
fix: changes for @typescript-eslint/array-type rule
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoniangreen committed Jul 7, 2024
1 parent 595fe58 commit 80d4033
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/types/json-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,25 +108,25 @@ type UncheckedJSONSchemaType<T, IsPartial extends boolean> = (
: UncheckedPropertiesSchema<T>
patternProperties?: Record<string, UncheckedJSONSchemaType<T[string], false>>
propertyNames?: Omit<UncheckedJSONSchemaType<string, false>, "type"> & {type?: "string"}
dependencies?: {[K in keyof T]?: Readonly<(keyof T)[]> | UncheckedPartialSchema<T>}
dependentRequired?: {[K in keyof T]?: Readonly<(keyof T)[]>}
dependencies?: {[K in keyof T]?: readonly (keyof T)[] | UncheckedPartialSchema<T>}
dependentRequired?: {[K in keyof T]?: readonly (keyof T)[]}
dependentSchemas?: {[K in keyof T]?: UncheckedPartialSchema<T>}
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<T>] extends [never]
? {required?: Readonly<UncheckedRequiredMembers<T>[]>}
: {required: Readonly<UncheckedRequiredMembers<T>[]>})
? {required?: readonly UncheckedRequiredMembers<T>[]}
: {required: readonly UncheckedRequiredMembers<T>[]})
: T extends null
? {
type: JSONType<"null", IsPartial>
nullable: true
}
: never) & {
allOf?: Readonly<UncheckedPartialSchema<T>[]>
anyOf?: Readonly<UncheckedPartialSchema<T>[]>
oneOf?: Readonly<UncheckedPartialSchema<T>[]>
allOf?: readonly UncheckedPartialSchema<T>[]
anyOf?: readonly UncheckedPartialSchema<T>[]
oneOf?: readonly UncheckedPartialSchema<T>[]
if?: UncheckedPartialSchema<T>
then?: UncheckedPartialSchema<T>
else?: UncheckedPartialSchema<T>
Expand Down Expand Up @@ -176,12 +176,12 @@ type Nullable<T> = 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<T[]>
enum?: readonly T[]
default?: T
}

0 comments on commit 80d4033

Please sign in to comment.