Skip to content

build: ensure build uses typescript 3.9 #19336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,32 +48,32 @@
},
"version": "10.0.0-next.0",
"dependencies": {
"@angular/animations": "^10.0.0-next.6",
"@angular/common": "^10.0.0-next.6",
"@angular/compiler": "^10.0.0-next.6",
"@angular/core": "^10.0.0-next.6",
"@angular/elements": "^10.0.0-next.6",
"@angular/forms": "^10.0.0-next.6",
"@angular/platform-browser": "^10.0.0-next.6",
"@angular/animations": "^10.0.0-next.8",
"@angular/common": "^10.0.0-next.8",
"@angular/compiler": "^10.0.0-next.8",
"@angular/core": "^10.0.0-next.8",
"@angular/elements": "^10.0.0-next.8",
"@angular/forms": "^10.0.0-next.8",
"@angular/platform-browser": "^10.0.0-next.8",
"@types/googlemaps": "^3.39.3",
"@types/youtube": "^0.0.38",
"@webcomponents/custom-elements": "^1.1.0",
"core-js": "^2.6.9",
"material-components-web": "7.0.0-canary.058cfd23c.0",
"rxjs": "^6.5.3",
"systemjs": "0.19.43",
"tslib": "^1.10.0",
"tslib": "^1.12.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/core": "^10.0.0-next.3",
"@angular-devkit/schematics": "^10.0.0-next.3",
"@angular/bazel": "^10.0.0-next.6",
"@angular/compiler-cli": "^10.0.0-next.6",
"@angular-devkit/core": "^10.0.0-next.5",
"@angular-devkit/schematics": "^10.0.0-next.5",
"@angular/bazel": "^10.0.0-next.8",
"@angular/compiler-cli": "^10.0.0-next.8",
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#414d7dd979092cb52d60b58596927abbc26d40b9",
"@angular/platform-browser-dynamic": "^10.0.0-next.6",
"@angular/platform-server": "^10.0.0-next.6",
"@angular/router": "^10.0.0-next.6",
"@angular/platform-browser-dynamic": "^10.0.0-next.8",
"@angular/platform-server": "^10.0.0-next.8",
"@angular/router": "^10.0.0-next.8",
"@bazel/bazelisk": "^1.4.0",
"@bazel/buildifier": "^2.2.1",
"@bazel/ibazel": "^0.13.0",
Expand All @@ -83,7 +83,7 @@
"@bazel/typescript": "^1.6.0",
"@firebase/app-types": "^0.3.2",
"@octokit/rest": "16.28.7",
"@schematics/angular": "^10.0.0-next.3",
"@schematics/angular": "^10.0.0-next.5",
"@types/autoprefixer": "^9.7.2",
"@types/browser-sync": "^2.26.1",
"@types/fs-extra": "^4.0.3",
Expand Down Expand Up @@ -161,7 +161,7 @@
"tsickle": "0.38.1",
"tslint": "^6.1.0",
"tsutils": "^3.17.1",
"typescript": "3.9.1-rc",
"typescript": "3.9.2",
"typescript-3.6": "npm:typescript@~3.6.4",
"typescript-3.7": "npm:typescript@~3.7.0",
"typescript-3.8": "npm:typescript@~3.8.0",
Expand All @@ -170,7 +170,7 @@
"yargs": "15.3.0"
},
"resolutions": {
"dgeni-packages/typescript": "3.8.3",
"dgeni-packages/typescript": "3.9.2",
"**/graceful-fs": "4.2.2"
}
}
2 changes: 1 addition & 1 deletion src/bazel-tsconfig-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"extends": "./bazel-tsconfig-build.json",
"compilerOptions": {
"importHelpers": false,
"importHelpers": true,
Copy link
Member Author

@devversion devversion May 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be set to true because the inline emitted helpers by TypeScript are currently broken in TS 3.9.2. A fix has landed, but will be available in the next patch..

microsoft/TypeScript#38501. We can leave this enabled anyway, or turn it back to false. Both have pros and cons.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW: The CLI has importHelpers: true for tests too.

"types": ["jasmine"]
},
"bazelOptions": {
Expand Down
4 changes: 4 additions & 0 deletions src/cdk/schematics/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ ts_library(
"testing/**/*.ts",
],
),
# Schematics do not need to run in browsers and can use `commonjs`
# as format instead the default `umd` format.
devmode_module = "commonjs",
module_name = "@angular/cdk/schematics",
prodmode_module = "commonjs",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The schematic code does not rely on importHelpers / tslib, so it currently breaks due to the aforementioned TS bug. We can fix this by building schematics always in commonjs. This might generally make sense to keep since schematics do not run in the browser.

tsconfig = ":tsconfig.json",
deps = [
"//src/cdk/schematics/update-tool",
Expand Down
4 changes: 4 additions & 0 deletions src/cdk/schematics/testing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ package(default_visibility = ["//visibility:public"])
ts_library(
name = "testing",
srcs = glob(["**/*.ts"]),
# Schematics do not need to run in browsers and can use `commonjs`
# as format instead the default `umd` format.
devmode_module = "commonjs",
module_name = "@angular/cdk/schematics/testing",
prodmode_module = "commonjs",
tsconfig = "tsconfig.json",
deps = [
"@npm//@angular-devkit/core",
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/schematics/testing/test-case-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export function _patchTypeScriptDefaultLib(tree: Tree) {
if (filePath.match(/node_modules[/\\]typescript/)) {
return readFileSync(getSystemPath(filePath));
} else {
return _originalRead.apply(this, arguments);
return _originalRead.call(this, filePath);
}
};
}
1 change: 1 addition & 0 deletions src/cdk/schematics/testing/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"strict": true,
"lib": ["es2015"],
"types": ["node", "jasmine", "glob"]
}
Expand Down
4 changes: 4 additions & 0 deletions src/cdk/schematics/update-tool/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ package(default_visibility = ["//visibility:public"])
ts_library(
name = "update-tool",
srcs = glob(["**/*.ts"]),
# Schematics do not need to run in browsers and can use `commonjs`
# as format instead the default `umd` format.
devmode_module = "commonjs",
module_name = "@angular/cdk/schematics/update-tool",
prodmode_module = "commonjs",
tsconfig = ":tsconfig.json",
deps = [
"@npm//@types/node",
Expand Down
16 changes: 3 additions & 13 deletions src/google-maps/google-map/google-map.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,8 @@ import {async, TestBed} from '@angular/core/testing';
import {By} from '@angular/platform-browser';

import {GoogleMapsModule} from '../google-maps-module';
import {
createMapConstructorSpy,
createMapSpy,
TestingWindow
} from '../testing/fake-google-map-utils';
import {
DEFAULT_HEIGHT,
DEFAULT_OPTIONS,
DEFAULT_WIDTH,
GoogleMap,
} from './google-map';
import {createMapConstructorSpy, createMapSpy} from '../testing/fake-google-map-utils';
import {DEFAULT_HEIGHT, DEFAULT_OPTIONS, DEFAULT_WIDTH, GoogleMap} from './google-map';

/** Represents boundaries of a map to be used in tests. */
const testBounds: google.maps.LatLngBoundsLiteral = {
Expand Down Expand Up @@ -47,8 +38,7 @@ describe('GoogleMap', () => {
});

afterEach(() => {
const testingWindow: TestingWindow = window;
delete testingWindow.google;
delete window.google;
});

it('throws an error is the Google Maps JavaScript API was not loaded', () => {
Expand Down
4 changes: 1 addition & 3 deletions src/google-maps/map-circle/map-circle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
createCircleSpy,
createMapConstructorSpy,
createMapSpy,
TestingWindow,
} from '../testing/fake-google-map-utils';

import {MapCircle} from './map-circle';
Expand Down Expand Up @@ -43,8 +42,7 @@ describe('MapCircle', () => {
});

afterEach(() => {
const testingWindow: TestingWindow = window;
delete testingWindow.google;
delete window.google;
});

it('initializes a Google Map Circle', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
createGroundOverlaySpy,
createMapConstructorSpy,
createMapSpy,
TestingWindow,
} from '../testing/fake-google-map-utils';

import {MapGroundOverlay} from './map-ground-overlay';
Expand Down Expand Up @@ -37,8 +36,7 @@ describe('MapGroundOverlay', () => {
});

afterEach(() => {
const testingWindow: TestingWindow = window;
delete testingWindow.google;
delete window.google;
});

it('initializes a Google Map Ground Overlay', () => {
Expand Down
10 changes: 4 additions & 6 deletions src/google-maps/map-info-window/map-info-window.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ import {async, TestBed} from '@angular/core/testing';
import {By} from '@angular/platform-browser';

import {DEFAULT_OPTIONS} from '../google-map/google-map';

import {GoogleMapsModule} from '../google-maps-module';
import {MapMarker} from '../map-marker/map-marker';
import {
createInfoWindowConstructorSpy,
createInfoWindowSpy,
createMapConstructorSpy,
createMapSpy,
TestingWindow
createMapSpy
} from '../testing/fake-google-map-utils';

import {GoogleMapsModule} from '../google-maps-module';
import {MapInfoWindow} from './map-info-window';

describe('MapInfoWindow', () => {
Expand All @@ -33,8 +32,7 @@ describe('MapInfoWindow', () => {
});

afterEach(() => {
const testingWindow: TestingWindow = window;
delete testingWindow.google;
delete window.google;
});

it('initializes a Google Map Info Window', () => {
Expand Down
10 changes: 4 additions & 6 deletions src/google-maps/map-marker/map-marker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ import {async, TestBed} from '@angular/core/testing';
import {By} from '@angular/platform-browser';

import {DEFAULT_OPTIONS} from '../google-map/google-map';

import {GoogleMapsModule} from '../google-maps-module';
import {
createMapConstructorSpy,
createMapSpy,
createMarkerConstructorSpy,
createMarkerSpy,
TestingWindow
createMarkerSpy
} from '../testing/fake-google-map-utils';

import {GoogleMapsModule} from '../google-maps-module';
import {DEFAULT_MARKER_OPTIONS, MapMarker} from './map-marker';

describe('MapMarker', () => {
Expand All @@ -32,8 +31,7 @@ describe('MapMarker', () => {
});

afterEach(() => {
const testingWindow: TestingWindow = window;
delete testingWindow.google;
delete window.google;
});

it('initializes a Google Map marker', () => {
Expand Down
4 changes: 1 addition & 3 deletions src/google-maps/map-polygon/map-polygon.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
createMapSpy,
createPolygonConstructorSpy,
createPolygonSpy,
TestingWindow,
} from '../testing/fake-google-map-utils';

import {MapPolygon} from './map-polygon';
Expand All @@ -36,8 +35,7 @@ describe('MapPolygon', () => {
});

afterEach(() => {
const testingWindow: TestingWindow = window;
delete testingWindow.google;
delete window.google;
});

it('initializes a Google Map Polygon', () => {
Expand Down
4 changes: 1 addition & 3 deletions src/google-maps/map-polyline/map-polyline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
createMapSpy,
createPolylineConstructorSpy,
createPolylineSpy,
TestingWindow,
} from '../testing/fake-google-map-utils';

import {MapPolyline} from './map-polyline';
Expand Down Expand Up @@ -40,8 +39,7 @@ describe('MapPolyline', () => {
});

afterEach(() => {
const testingWindow: TestingWindow = window;
delete testingWindow.google;
delete window.google;
});

it('initializes a Google Map Polyline', () => {
Expand Down
4 changes: 1 addition & 3 deletions src/google-maps/map-rectangle/map-rectangle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
createMapSpy,
createRectangleConstructorSpy,
createRectangleSpy,
TestingWindow,
} from '../testing/fake-google-map-utils';

import {MapRectangle} from './map-rectangle';
Expand All @@ -36,8 +35,7 @@ describe('MapRectangle', () => {
});

afterEach(() => {
const testingWindow: TestingWindow = window;
delete testingWindow.google;
delete window.google;
});

it('initializes a Google Map Rectangle', () => {
Expand Down
6 changes: 6 additions & 0 deletions src/google-maps/testing/fake-google-map-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
* found in the LICENSE file at https://angular.io/license
*/

// The global `window` variable is typed as an intersection of `Window` and `globalThis`.
// We re-declare `window` here and omit `globalThis` as it is typed with the actual Google
// Maps types which we intend to override with jasmine spies for testing. Keeping `globalThis`
// would mean that `window` is not assignable to our testing window.
declare var window: Window;

/** Window interface for testing */
export interface TestingWindow extends Window {
google?: {
Expand Down
2 changes: 1 addition & 1 deletion src/material/button-toggle/button-toggle.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('button-toggle', () => {
beforeEach(async () => await browser.get('/button-toggle'));

it('should show a button-toggle', async () => {
expect(await element(by.tagName('mat-button-toggle'))).toBeDefined();
expect(await element(by.tagName('mat-button-toggle')).isPresent()).toBe(true);
});

});
2 changes: 1 addition & 1 deletion src/material/card/card.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('mat-card', () => {
beforeEach(async () => await browser.get('/cards'));

it('should show a card', async () => {
expect(await element(by.tagName('mat-card'))).toBeDefined();
expect(await element(by.tagName('mat-card')).isPresent()).toBe(true);
});

});
2 changes: 1 addition & 1 deletion src/material/expansion/expansion.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('expansion', () => {
beforeEach(async () => await browser.get('/expansion'));

it('should show an accordion', async () => {
expect(await element(by.css('.mat-accordion'))).toBeDefined();
expect(await element(by.css('.mat-accordion')).isPresent()).toBe(true);
});

it('should show two panels', async () => {
Expand Down
4 changes: 4 additions & 0 deletions src/material/schematics/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ ts_library(
"ng-generate/*/files/**/*.ts",
],
),
# Schematics do not need to run in browsers and can use `commonjs`
# as format instead the default `umd` format.
devmode_module = "commonjs",
module_name = "@angular/material/schematics",
prodmode_module = "commonjs",
tsconfig = ":tsconfig.json",
deps = [
"//src/cdk/schematics",
Expand Down
2 changes: 1 addition & 1 deletion src/material/toolbar/toolbar.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('mat-toolbar', () => {
beforeEach(async () => await browser.get('/toolbar'));

it('should show a toolbar', async () => {
expect(await element(by.tagName('mat-toolbar'))).toBeDefined();
expect(await element(by.tagName('mat-toolbar')).isPresent()).toBe(true);
});

});
Loading