Skip to content

Commit 3ad85f8

Browse files
committed
fix: explictly declare types for mixin base classes
As of TypeScript 2.9, tsc will inline imports for inferred types with the `import("...")` syntax. However, this inlining happens *after* `paths` are resolved. This means that in places where we import from `@angular/material/core` in source end up having relative paths (e.g. `../core/common-behaviors/index`) in the generated d.ts files. These relative import paths become incorrect when moved into our package structure, breaking downstream apps.
1 parent 73d54a4 commit 3ad85f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+392
-243
lines changed

package-lock.json

Lines changed: 67 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
"version": "6.4.6",
2828
"requiredAngularVersion": ">=6.0.0 <7.0.0",
2929
"dependencies": {
30-
"@angular/animations": "^6.1.0",
31-
"@angular/common": "^6.1.0",
32-
"@angular/compiler": "^6.1.0",
33-
"@angular/core": "^6.1.0",
34-
"@angular/elements": "^6.1.0",
35-
"@angular/forms": "^6.1.0",
36-
"@angular/platform-browser": "^6.1.0",
30+
"@angular/animations": "7.0.0-beta.3",
31+
"@angular/common": "7.0.0-beta.3",
32+
"@angular/compiler": "7.0.0-beta.3",
33+
"@angular/core": "7.0.0-beta.3",
34+
"@angular/elements": "7.0.0-beta.3",
35+
"@angular/forms": "7.0.0-beta.3",
36+
"@angular/platform-browser": "7.0.0-beta.3",
3737
"@webcomponents/custom-elements": "^1.1.0",
3838
"core-js": "^2.4.1",
3939
"rxjs": "^6.2.0",
@@ -45,13 +45,13 @@
4545
"devDependencies": {
4646
"@angular-devkit/core": "^0.7.1",
4747
"@angular-devkit/schematics": "^0.7.1",
48-
"@angular/bazel": "^6.1.0",
49-
"@angular/compiler-cli": "^6.1.0",
50-
"@angular/http": "^6.1.0",
51-
"@angular/platform-browser-dynamic": "^6.1.0",
52-
"@angular/platform-server": "^6.1.0",
53-
"@angular/router": "^6.1.0",
54-
"@angular/upgrade": "^6.1.0",
48+
"@angular/bazel": "7.0.0-beta.3",
49+
"@angular/compiler-cli": "7.0.0-beta.3",
50+
"@angular/http": "7.0.0-beta.3",
51+
"@angular/platform-browser-dynamic": "7.0.0-beta.3",
52+
"@angular/platform-server": "7.0.0-beta.3",
53+
"@angular/router": "7.0.0-beta.3",
54+
"@angular/upgrade": "7.0.0-beta.3",
5555
"@bazel/ibazel": "0.3.1",
5656
"@google-cloud/storage": "^1.1.1",
5757
"@octokit/rest": "^15.9.4",

src/cdk/table/can-stick.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ export interface CanStick {
3131
resetStickyChanged(): void;
3232
}
3333

34+
/** @docs-private */
35+
export type CanStickCtor = Constructor<CanStick>;
36+
3437
/**
3538
* Mixin to provide a directive with a function that checks if the sticky input has been
3639
* changed since the last time the function was called. Essentially adds a dirty-check to the
3740
* sticky value.
3841
* @docs-private
3942
*/
40-
export function mixinHasStickyInput<T extends Constructor<{}>>(base: T):
41-
Constructor<CanStick> & T {
43+
export function mixinHasStickyInput<T extends Constructor<{}>>(base: T): CanStickCtor & T {
4244
return class extends base {
4345
/** Whether sticky positioning should be applied. */
4446
get sticky(): boolean { return this._sticky; }

src/cdk/table/cell.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ContentChild, Directive, ElementRef, Input, TemplateRef} from '@angular/core';
109
import {coerceBooleanProperty} from '@angular/cdk/coercion';
11-
import {CanStick, mixinHasStickyInput} from './can-stick';
10+
import {ContentChild, Directive, ElementRef, Input, TemplateRef} from '@angular/core';
11+
import {CanStick, CanStickCtor, mixinHasStickyInput} from './can-stick';
12+
1213

1314
/** Base interface for a cell definition. Captures a column's cell template definition. */
1415
export interface CellDef {
@@ -45,7 +46,8 @@ export class CdkFooterCellDef implements CellDef {
4546
// Boilerplate for applying mixins to CdkColumnDef.
4647
/** @docs-private */
4748
export class CdkColumnDefBase {}
48-
export const _CdkColumnDefBase = mixinHasStickyInput(CdkColumnDefBase);
49+
export const _CdkColumnDefBase: CanStickCtor & typeof CdkColumnDefBase =
50+
mixinHasStickyInput(CdkColumnDefBase);
4951

5052
/**
5153
* Column definition for the CDK table.

src/cdk/table/row.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import {
2020
ViewContainerRef,
2121
ViewEncapsulation,
2222
} from '@angular/core';
23+
import {CanStick, CanStickCtor, mixinHasStickyInput} from './can-stick';
2324
import {CdkCellDef, CdkColumnDef} from './cell';
24-
import {CanStick, mixinHasStickyInput} from './can-stick';
2525

2626
/**
2727
* The row template that can be used by the mat-table. Should not be used outside of the
@@ -76,7 +76,8 @@ export abstract class BaseRowDef implements OnChanges {
7676
// Boilerplate for applying mixins to CdkHeaderRowDef.
7777
/** @docs-private */
7878
export class CdkHeaderRowDefBase extends BaseRowDef {}
79-
export const _CdkHeaderRowDefBase = mixinHasStickyInput(CdkHeaderRowDefBase);
79+
export const _CdkHeaderRowDefBase: CanStickCtor & typeof CdkHeaderRowDefBase =
80+
mixinHasStickyInput(CdkHeaderRowDefBase);
8081

8182
/**
8283
* Header row definition for the CDK table.
@@ -101,7 +102,8 @@ export class CdkHeaderRowDef extends _CdkHeaderRowDefBase implements CanStick, O
101102
// Boilerplate for applying mixins to CdkFooterRowDef.
102103
/** @docs-private */
103104
export class CdkFooterRowDefBase extends BaseRowDef {}
104-
export const _CdkFooterRowDefBase = mixinHasStickyInput(CdkFooterRowDefBase);
105+
export const _CdkFooterRowDefBase: CanStickCtor & typeof CdkFooterRowDefBase =
106+
mixinHasStickyInput(CdkFooterRowDefBase);
105107

106108
/**
107109
* Footer row definition for the CDK table.

0 commit comments

Comments
 (0)