Skip to content

Commit

Permalink
ReadonlyDeep: Fix usage with properties defined with void (#782)
Browse files Browse the repository at this point in the history
  • Loading branch information
Emiyaaaaa committed Dec 7, 2023
1 parent ebb7a59 commit a919f93
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ export type Subtract<A extends number, B extends number> = BuildTuple<A> extends
: never;

/**
Matches any primitive, `Date`, or `RegExp` value.
Matches any primitive, `void`, `Date`, or `RegExp` value.
*/
export type BuiltIns = Primitive | Date | RegExp;
export type BuiltIns = Primitive | void | Date | RegExp;

/**
Matches non-recursive types.
Expand Down
12 changes: 12 additions & 0 deletions test-d/readonly-deep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,15 @@ expectType<NamespaceWithOverload>(readonlyData.namespaceWithOverload);
expectType<string>(readonlyData.namespaceWithOverload(1));
expectType<number>(readonlyData.namespaceWithOverload('foo', 1));
expectType<boolean[]>(readonlyData.namespaceWithOverload.baz);

// Test void
type VoidType = {
foo: void;
bar: string | void;
};
type VoidTypeExpected = {
readonly foo: void;
readonly bar: string | void;
};
declare const voidType: ReadonlyDeep<VoidType>;
expectType<VoidTypeExpected>(voidType);

0 comments on commit a919f93

Please sign in to comment.