Skip to content

Add support for Typescript 3.2 #13226

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 5 commits into from
Dec 19, 2018
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
2 changes: 1 addition & 1 deletion etc/api/angular_devkit/schematics/tools/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,4 @@ export declare class SchematicNameCollisionException extends BaseException {
constructor(name: string);
}

export declare function validateOptionsWithSchema(registry: schema.SchemaRegistry): <T extends {}>(schematic: FileSystemSchematicDescription, options: T, context?: import("@angular-devkit/schematics/src/engine/interface").TypedSchematicContext<import("@angular-devkit/schematics/tools/tools/description").FileSystemCollectionDescription, FileSystemSchematicDescription> | undefined) => Observable<T>;
export declare function validateOptionsWithSchema(registry: schema.SchemaRegistry): <T extends {}>(schematic: FileSystemSchematicDescription, options: T, context?: import("@angular-devkit/schematics").TypedSchematicContext<import("@angular-devkit/schematics/tools/tools/description").FileSystemCollectionDescription, FileSystemSchematicDescription> | undefined) => Observable<T>;
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@
"quicktype-core": "^6.0.15",
"temp": "^0.8.3",
"tslint": "^5.11.0",
"typescript": "~3.1.6",
"typescript": "~3.2.2",
"yarn": "^1.10.1"
},
"devDependencies": {
"@angular/compiler": "^7.1.0",
"@angular/compiler-cli": "^7.1.0",
"@angular/compiler": "^7.2.0-rc.0",
"@angular/compiler-cli": "^7.2.0-rc.0",
"@bazel/karma": "^0.20.3",
"@bazel/typescript": "0.20.3",
"@ngtools/json-schema": "^1.1.0",
Expand Down
24 changes: 12 additions & 12 deletions packages/angular_devkit/build_angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@
"node-sass": "4.10.0"
},
"devDependencies": {
"@angular/animations": "^7.1.0",
"@angular/cdk": "^7.1.0",
"@angular/common": "^7.1.0",
"@angular/compiler": "^7.1.0",
"@angular/compiler-cli": "^7.1.0",
"@angular/core": "^7.1.0",
"@angular/http": "^7.1.0",
"@angular/animations": "^7.2.0-rc.0",
"@angular/cdk": "^7.2.0-rc.0",
"@angular/common": "^7.2.0-rc.0",
"@angular/compiler": "^7.2.0-rc.0",
"@angular/compiler-cli": "^7.2.0-rc.0",
"@angular/core": "^7.2.0-rc.0",
"@angular/http": "^7.2.0-rc.0",
"@angular/material": "^7.1.0",
"@angular/platform-browser": "^7.1.0",
"@angular/platform-browser-dynamic": "^7.1.0",
"@angular/platform-server": "^7.1.0",
"@angular/router": "^7.1.0",
"@angular/service-worker": "^7.1.0",
"@angular/platform-browser": "^7.2.0-rc.0",
"@angular/platform-browser-dynamic": "^7.2.0-rc.0",
"@angular/platform-server": "^7.2.0-rc.0",
"@angular/router": "^7.2.0-rc.0",
"@angular/service-worker": "^7.2.0-rc.0",
"codelyzer": "^4.2.1",
"core-js": "^2.4.1",
"bootstrap": "^4.0.0",
Expand Down
109 changes: 109 additions & 0 deletions packages/angular_devkit/build_angular/test/browser/aot_spec_large.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,113 @@ describe('Browser Builder AOT', () => {
}),
).toPromise().then(done, done.fail);
});

it('works with aliased imports', (done) => {
const overrides = { aot: true };

host.writeMultipleFiles({
'src/app/app.component.ts': `import { Component } from '@angular/core';
import { from as fromPromise } from 'rxjs';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app-component';

constructor() {
console.log(fromPromise(Promise.resolve('test')));
}
}`,
});

runTargetSpec(host, browserTargetSpec, overrides).pipe(
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
tap(() => {
const fileName = join(outputPath, 'main.js');
const content = virtualFs.fileBufferToString(host.scopedSync().read(normalize(fileName)));
// if the aliased import was dropped this won't be rewired to a webpack module.
expect(content).toMatch(/rxjs__WEBPACK_IMPORTED_.+[\"from\"]/);
expect(content).not.toContain('fromPromise');
}),
).toPromise().then(done, done.fail);
});

it('works with aliased imports from an exported object literal', (done) => {
const overrides = { aot: true };

host.writeMultipleFiles({
'src/foo.ts': `
import { from as fromPromise } from 'rxjs';
export { fromPromise };
`,
'src/app/app.component.ts': `
import { Component } from '@angular/core';
import { fromPromise } from '../foo';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app-component';

constructor() {
console.log(fromPromise(Promise.resolve('test')));
}
}`,
});

runTargetSpec(host, browserTargetSpec, overrides).pipe(
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
tap(() => {
const fileName = join(outputPath, 'main.js');
const content = virtualFs.fileBufferToString(host.scopedSync().read(normalize(fileName)));
// if the aliased import was dropped this won't be rewired to a webpack module.
expect(content).toMatch(/rxjs__WEBPACK_IMPORTED_.+[\"from\"]/);
expect(content).toMatch(/rxjs__WEBPACK_IMPORTED_.+[\"fromPromise\"]/);
}),
).toPromise().then(done, done.fail);
});

it('works with aliased imports from an alias export', (done) => {
const overrides = { aot: true };

host.writeMultipleFiles({
'src/foo.ts': `
export { from as fromPromise } from 'rxjs';
`,
'src/app/app.component.ts': `
import { Component } from '@angular/core';
import { fromPromise } from '../foo';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app-component';

constructor() {
console.log(fromPromise(Promise.resolve('test')));
}
}`,
});

runTargetSpec(host, browserTargetSpec, overrides).pipe(
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
tap(() => {
const fileName = join(outputPath, 'main.js');
const content = virtualFs.fileBufferToString(host.scopedSync().read(normalize(fileName)));
// if the aliased import was dropped this won't be rewired to a webpack module.
expect(content).toMatch(/rxjs__WEBPACK_IMPORTED_.+[\"from\"]/);
expect(content).toMatch(/rxjs__WEBPACK_IMPORTED_.+[\"fromPromise\"]/);
}),
).toPromise().then(done, done.fail);
});

});
4 changes: 2 additions & 2 deletions packages/angular_devkit/build_ng_packagr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"ng-packagr": "^2.2.0 || ^3.0.0 || ^4.0.0"
},
"devDependencies": {
"@angular/compiler": "^7.1.0",
"@angular/compiler-cli": "^7.1.0",
"@angular/compiler": "^7.2.0-rc.0",
"@angular/compiler-cli": "^7.2.0-rc.0",
"ng-packagr": "^4.2.0",
"tsickle": ">=0.34.0",
"tslib": "^1.9.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/build_optimizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"loader-utils": "1.1.0",
"source-map": "0.5.6",
"typescript": "3.1.6",
"typescript": "3.2.2",
"webpack-sources": "1.2.0"
}
}
8 changes: 4 additions & 4 deletions packages/ngtools/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
},
"peerDependencies": {
"@angular/compiler-cli": ">=5.0.0 <8.0.0 || ^7.0.0-beta.0",
"typescript": ">=2.4.0 < 3.2",
"typescript": ">=2.4.0 < 3.3",
"webpack": "^4.0.0"
},
"devDependencies": {
"@angular/compiler": "^7.1.0",
"@angular/compiler-cli": "^7.1.0",
"typescript": "~3.1.6",
"@angular/compiler": "^7.2.0-rc.0",
"@angular/compiler-cli": "^7.2.0-rc.0",
"typescript": "~3.2.2",
"webpack": "^4.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/ngtools/webpack/src/transformers/elide_imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function elideImports(
// "import { XYZ, ... } from 'abc';"
const specifierOps = [];
for (const specifier of node.importClause.namedBindings.elements) {
if (isUnused(specifier.propertyName || specifier.name)) {
if (isUnused(specifier.name)) {
specifierOps.push(new RemoveNodeOperation(sourceFile, specifier));
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"dependencies": {
"@angular-devkit/core": "0.0.0",
"@angular-devkit/schematics": "0.0.0",
"typescript": "3.1.6"
"typescript": "3.2.2"
}
}
4 changes: 2 additions & 2 deletions packages/schematics/angular/utility/latest-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

export const latestVersions = {
// These versions should be kept up to date with latest Angular peer dependencies.
Angular: '~7.1.0',
Angular: '~7.2.0-rc.0',
RxJs: '~6.3.3',
ZoneJs: '~0.8.26',
TypeScript: '~3.1.6',
TypeScript: '~3.2.2',
TsLib: '^1.9.0',
// The versions below must be manually updated when making a new devkit release.
DevkitBuildAngular: '~0.12.0-beta.2',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"@types/jasmine": "^2.6.0",
"@types/node": "^8.0.31",
"jasmine": "^2.8.0",
"typescript": "~3.1.6"
"typescript": "~3.2.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"@types/jasmine": "^2.6.0",
"@types/node": "^8.0.31",
"jasmine": "^2.8.0",
"typescript": "~3.1.6"
"typescript": "~3.2.2"
}
}
Loading