Skip to content

Commit

Permalink
fix: head off breaking change in ts@next
Browse files Browse the repository at this point in the history
  • Loading branch information
andnp committed Mar 10, 2019
1 parent 222befe commit 7305279
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/types/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export type HasKey<T, K extends keyof any> = K extends Keys<T> ? True : False;
export type UnionKeys<T>
// Using a conditional here, so that it distributes over members of the union
// See https://www.typescriptlang.org/docs/handbook/advanced-types.html#distributive-conditional-types
= T extends any ? keyof T : never;
= T extends unknown ? keyof T : never;

// -------------
// Manipulations
Expand Down Expand Up @@ -261,6 +261,6 @@ export type StrictUnion<T> = _StrictUnionHelper<T, T>;
// to refer to each individual member of the union
/** no-doc */
export type _StrictUnionHelper<UnionMember, Union> =
UnionMember extends any ?
UnionMember extends unknown ?
UnionMember & Partial<Record<Exclude<UnionKeys<Union>, keyof UnionMember>, never>>
: never;
2 changes: 1 addition & 1 deletion test/objects/UnionKeys.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import test from 'ava';
import { assert } from '../helpers/assert';

import { AllKeys, UnionKeys } from '../../src';
import { UnionKeys } from '../../src';

test('Can get all keys between objects in a union', t => {
type a = { w: number, x: string };
Expand Down

0 comments on commit 7305279

Please sign in to comment.