diff --git a/source/internal.d.ts b/source/internal.d.ts index b21cb367a..7b7412ef9 100644 --- a/source/internal.d.ts +++ b/source/internal.d.ts @@ -67,9 +67,9 @@ export type Subtract = BuildTuple extends : never; /** -Matches any primitive, `Date`, or `RegExp` value. +Matches any primitive, `Date`, `RegExp`, `Element` value. */ -export type BuiltIns = Primitive | Date | RegExp; +export type BuiltIns = Primitive | Date | RegExp | Element; export type UpperCaseCharacters = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z'; diff --git a/test-d/partial-deep.ts b/test-d/partial-deep.ts index 2560d85ea..0e804cc52 100644 --- a/test-d/partial-deep.ts +++ b/test-d/partial-deep.ts @@ -10,6 +10,7 @@ const foo = { bar: { function: (_: string): void => undefined, classConstructor: ClassA, + element: document.createElement('div'), object: {key: 'value'}, string: 'waldo', number: 1, @@ -41,6 +42,7 @@ const instance = new partialDeepFoo.bar!.classConstructor!(); instance.foo = 2; const b = partialDeepFoo.bar!.constructor; expectType<((_: string) => void) | undefined>(partialDeepFoo.bar!.function); +expectType(partialDeepFoo.bar!.element); expectAssignable(partialDeepFoo.bar!.object); expectType(partialDeepFoo.bar!.string); expectType(partialDeepFoo.bar!.number); @@ -100,3 +102,14 @@ expectAssignable | undefined expectAssignable | undefined>(partialDeepNoRecurseIntoArraysBar.readonlySet); expectType(partialDeepNoRecurseIntoArraysBar.readonlyArray); expectType(partialDeepNoRecurseIntoArraysBar.readonlyTuple); + +// Test for interface +// eslint-disable-next-line @typescript-eslint/consistent-type-definitions +interface InterfaceType { + string: string; + object: { + number: number; + }; +} +declare const interfaceType: PartialDeep; +expectType<{string?: string; object?: {number?: number}}>(interfaceType);