-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(ngrid): bump angular to version 8.2.2
BREAKING CHANGE: - This bump included a bump in TS as well, to 3.5.3. TS 3.5.3 introduces a breaking change which was fixed in this commit. - Moving from @angular/cli 8.0.3 introduces a breaking change. The package @ngtools/webpack@8.0.4 is now adding `ctorParameters` property to all classes with ctor params, even the non-injectable ones which now will have a hard reference leading to a circular dependency error. This commit includes a refactor of the code to fit this paradigm until someone in angular understands this and push a fix...
- Loading branch information
1 parent
f92b37a
commit 8f82092
Showing
14 changed files
with
627 additions
and
472 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,108 +1,11 @@ | ||
// COPIED FROM https://github.com/pelotom/type-zoo | ||
// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir | ||
|
||
// TypeScript Version: 2.8 | ||
export type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? A : B; | ||
|
||
/** | ||
* Drop keys `K` from `T`. | ||
* | ||
* @see https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-377567046 | ||
*/ | ||
export type Omit<T, K extends keyof any> = T extends any ? Pick<T, Exclude<keyof T, K>> : never; | ||
export type WritableKeys<T> = { | ||
[P in keyof T]-?: IfEquals<{ [Q in P]: T[P] }, { -readonly [Q in P]: T[P] }, P> | ||
}[keyof T]; | ||
|
||
/** | ||
* Like `T & U`, but where there are overlapping properties using the | ||
* type from U only. | ||
* | ||
* @see Old: https://github.com/pelotom/type-zoo/issues/2 | ||
* @see Old: https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-307871458 | ||
* @see New: https://github.com/pelotom/type-zoo/pull/14#discussion_r183527882 | ||
*/ | ||
export type Overwrite<T, U> = Omit<T, keyof T & keyof U> & U; | ||
|
||
/** | ||
* Use to prevent a usage of type `T` from being inferred in other generics. | ||
* | ||
* Example: | ||
* declare function assertEqual<T>(actual: T, expected: NoInfer<T>): boolean; | ||
* | ||
* Type `T` will now only be inferred based on the type of the `actual` param, and | ||
* the `expected` param is required to be assignable to the type of `actual`. | ||
* This allows you to give one particular usage of type `T` full control over how the | ||
* compiler infers type `T`. | ||
* | ||
* @see https://github.com/Microsoft/TypeScript/issues/14829#issuecomment-322267089 | ||
*/ | ||
export type NoInfer<T> = T & { [K in keyof T]: T[K] }; | ||
|
||
/** | ||
* Forgets contextual knowledge of partiality of keys. | ||
*/ | ||
export type Purify<T extends string> = { [P in T]: T }[T]; | ||
|
||
/** | ||
* Selects the type of the 0th parameter in a function-type | ||
*/ | ||
export type Param0<Func> = Func extends (a: infer T, ...args: any[]) => any ? T : never; | ||
/** | ||
* Selects the type of the 1st parameter in a function-type | ||
*/ | ||
export type Param1<Func> = Func extends (a: any, b: infer T, ...args: any[]) => any ? T : never; | ||
/** | ||
* Selects the type of the 2nd parameter in a function-type | ||
*/ | ||
export type Param2<Func> = Func extends (a: any, b: any, c: infer T, ...args: any[]) => any | ||
? T | ||
: never; | ||
/** | ||
* Selects the type of the 3rd parameter in a function-type | ||
*/ | ||
export type Param3<Func> = Func extends (a: any, b: any, c: any, d: infer T, ...args: any[]) => any | ||
? T | ||
: never; | ||
/** | ||
* Selects the types of all the parameters in a function-type. | ||
* Warnings: | ||
* - This is probably less performant if you're only looking up a single param! {@see Param0-Param# } | ||
* - This omits rest parameters (...args:any[]) | ||
*/ | ||
export type ParamTypes<F extends Function> = F extends () => any // tslint:disable-line | ||
? {} | ||
: F extends (p0: infer P0) => any | ||
? [P0] | ||
: F extends (p0: infer P0, p1: infer P1) => any | ||
? [P0, P1] | ||
: F extends (p0: infer P0, p1: infer P1, p2: infer P2) => any | ||
? [P0, P1, P2] | ||
: F extends (p0: infer P0, p1: infer P1, p2: infer P2, p3: infer P3) => any | ||
? [P0, P1, P2, P3] | ||
: // ... -- extend this at your own risk, this could be bad for compilation performance! | ||
never; | ||
|
||
/** | ||
* Picks 2 levels deep into a nested object! | ||
* | ||
* @see https://gist.github.com/staltz/368866ea6b8a167fbdac58cddf79c1bf | ||
*/ | ||
export type Pick2<T, K1 extends keyof T, K2 extends keyof T[K1]> = { | ||
[P1 in K1]: { [P2 in K2]: (T[K1])[P2] } | ||
}; | ||
|
||
/** | ||
* Picks 3 levels deep into a nested object! | ||
* | ||
* @see https://gist.github.com/staltz/368866ea6b8a167fbdac58cddf79c1bf | ||
*/ | ||
export type Pick3<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]> = { | ||
[P1 in K1]: { [P2 in K2]: { [P3 in K3]: ((T[K1])[K2])[P3] } } | ||
}; | ||
|
||
/** | ||
* Picks 4 levels deep into a nested object! | ||
*/ | ||
export type Pick4< | ||
T, | ||
K1 extends keyof T, | ||
K2 extends keyof T[K1], | ||
K3 extends keyof T[K1][K2], | ||
K4 extends keyof T[K1][K2][K3] | ||
> = { [P1 in K1]: { [P2 in K2]: { [P3 in K3]: { [P4 in K4]: (((T[K1])[K2])[K3])[P4] } } } }; | ||
export type ReadonlyKeys<T> = { | ||
[P in keyof T]-?: IfEquals<{ [Q in P]: T[P] }, { -readonly [Q in P]: T[P] }, never, P> | ||
}[keyof T]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.