Skip to content

Commit

Permalink
Support typescript 2.9 (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
jscheiny authored Jun 20, 2018
1 parent 92c7b7f commit d4389f0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"tslint-config-standard": "^7.0.0",
"tslint-no-circular-imports": "^0.4.0",
"tslint-plugin-prettier": "^1.3.0",
"typescript": "~2.8.3"
"typescript": "~2.9.1"
}
}
7 changes: 2 additions & 5 deletions src/measure/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export type NthRootableUnit<N extends Exponent> = Partial<{
/** Handle errors in the result of an arithmetic operation. */
export type HandleErrors<Result extends ArithmeticResult> = true extends ResultHasError<Result>
? ArithmeticError
: Clean<StripZeroes<RemoveErrors<Result>>>;
: StripZeroes<RemoveErrors<Result>>;

export type ResultHasError<Result> = { [Dim in keyof Result]: IsArithmeticError<Result[Dim]> }[keyof Result];

Expand All @@ -49,14 +49,11 @@ export type ArithmeticResult = { [dimension: string]: Exponent | ArithmeticError

// Utility types

/** Ensures that a type will be displayed nicely in editors / compiler output */
export type Clean<T> = { [K in keyof T]: T[K] };

/** Removes all zero exponent dimensions from a dimension vector */
export type StripZeroes<U extends Unit> = Pick<U, NonZeroKeys<U>>;

export type NonZeroKeys<U extends Unit> = { [Dim in keyof U]: U[Dim] extends 0 ? never : Dim }[keyof U];

export type GetExponent<U extends Unit, K extends string> = K extends keyof Unit
export type GetExponent<U extends Unit, K> = K extends keyof Unit
? (undefined extends U[K] ? 0 : NonNullable<U[K]>)
: 0;
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3369,9 +3369,9 @@ type-check@~0.3.2:
dependencies:
prelude-ls "~1.1.2"

typescript@~2.8.3:
version "2.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.3.tgz#5d817f9b6f31bb871835f4edf0089f21abe6c170"
typescript@~2.9.1:
version "2.9.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"

uglify-js@^2.6:
version "2.8.29"
Expand Down

0 comments on commit d4389f0

Please sign in to comment.