Skip to content

Commit

Permalink
test: avoid the void regression
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Jun 13, 2021
1 parent 42b7c9b commit 5a6144a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export type ReturnTypeOf<T extends AnyFunction | AnyFunction[]> =
? ReturnType<T>
: T extends AnyFunction[]
? // exclude `void` from intersection, see octokit/octokit.js#2115
UnionToIntersection<Exclude<ReturnType<T[number]>, void>>
// UnionToIntersection<Exclude<ReturnType<T[number]>, void>>
UnionToIntersection<ReturnType<T[number]>>
: never;

/**
Expand Down
1 change: 1 addition & 0 deletions test/typescript-validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function pluginsTest() {
const octokitWithVoidAndNonVoidPlugins =
new OctokitWithVoidAndNonVoidPlugins();

expectType<void>(octokitWithVoidAndNonVoidPlugins);
expectType<string>(octokitWithVoidAndNonVoidPlugins.foo);
expectType<string>(octokitWithVoidAndNonVoidPlugins.bar);
}

0 comments on commit 5a6144a

Please sign in to comment.