Skip to content

Commit

Permalink
feat: remove the string condition on IsNever
Browse files Browse the repository at this point in the history
Thanks to @krisdages for finding this! This commit removes the `string`
condition on `IsNever` because `keyof never === keyof any === string`.

Closes: #109
  • Loading branch information
andnp committed Jul 22, 2019
1 parent 7d922f5 commit d8a29c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/types/predicates.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { False, True, And, Or, Not } from './conditionals';
import { False, True, And, Or, Not, If } from './conditionals';

/** no-doc */
export type KnownProblemPrototypeKeys = 'toString' | 'toLocaleString' | 'hasOwnProperty' | 'isPrototypeOf' | 'propertyIsEnumerable' | 'constructor' | 'valueOf';
Expand All @@ -15,7 +15,7 @@ export type ObjectPrototypeKeys = keyof Object;
/** no-doc */
export type FunctionPrototypeKeys = keyof Function;

export type IsNever<S extends string> = Not<(Record<S, True> & Record<string, False>)[S]>;
export type IsNever<T> = keyof any extends keyof T ? If<IsAny<T>, False, True> : False;
export type IsType<T, X> = X extends T ? True : False;
export type IsArray<T> = T extends unknown[] ? True : False;
export type IsNumber<T> = T extends number ? True : False;
Expand Down

0 comments on commit d8a29c1

Please sign in to comment.