refactor: update angular to support TypeScript 2.4

Detailed updates:
- rxjs@5.0.x
- tsickle@0.24.x
- typescript@2.4.x
- @bazel/typescript@0.10.0
- protractor@5.1.x
- selenium-webdriver@3.0.x

BREAKING CHANGE:
- the Angular compiler now requires TypeScript 2.4.x.
This commit is contained in:
Tobias Bosch
2017-09-08 18:40:32 -07:00
committed by Matias Niemelä
parent 112e777b90
commit ca5aebaa6b
49 changed files with 429 additions and 363 deletions

View File

@ -75,7 +75,7 @@ describe('tsc-wrapped', () => {
// No helpers since decorators were lowered
expect(out).not.toContain('__decorate');
// Expand `export *` and fix index import
expect(out).toContain(`export { A, B } from './dep'`);
expect(out).toContain(`export { A, B } from "./dep"`);
// Annotated for Closure compiler
expect(out).toContain('* @param {?} x');
// Comments should stay multi-line
@ -112,7 +112,7 @@ describe('tsc-wrapped', () => {
.then(() => {
const out = readOut('js');
// Expand `export *` and fix index import
expect(out).toContain(`export { A, B } from './dep'`);
expect(out).toContain(`export { A, B } from "./dep"`);
// Annotated for Closure compiler
expect(out).toContain('* @param {?} x');
done();
@ -327,7 +327,7 @@ describe('tsc-wrapped', () => {
main(basePath, {basePath})
.then(() => {
const out = readOut('js.map');
expect(out).toContain('"sources":["other_test.ts","../test.ts"]');
expect(out).toContain('"sources":["other_test.ts"]');
done();
})
.catch(e => done.fail(e));
@ -361,7 +361,7 @@ describe('tsc-wrapped', () => {
main(basePath, {basePath})
.then(() => {
const out = readOut('js.map');
expect(out).toContain('"sources":["other_test.ts","../test.ts"]');
expect(out).toContain('"sources":["other_test.ts"]');
done();
})
.catch(e => done.fail(e));
@ -387,7 +387,7 @@ describe('tsc-wrapped', () => {
main(basePath, {basePath})
.then(() => {
const fileOutput = readOut('js');
expect(fileOutput).toContain(`export { A, B } from './dep'`);
expect(fileOutput).toContain(`export { A, B } from "./dep"`);
done();
})
.catch(e => done.fail(e));

View File

@ -97,7 +97,7 @@ describe('Symbols', () => {
switch (node.kind) {
case ts.SyntaxKind.VariableStatement:
case ts.SyntaxKind.VariableDeclarationList:
return ts.forEachChild(node, visit);
return !!ts.forEachChild(node, visit);
case ts.SyntaxKind.VariableDeclaration:
const variableDeclaration = <ts.VariableDeclaration>node;
const nameNode = <ts.Identifier>variableDeclaration.name;

View File

@ -34,6 +34,8 @@ export class Host implements ts.LanguageServiceHost {
if (content) return ts.ScriptSnapshot.fromString(content);
}
fileExists(fileName: string): boolean { return this.getFileContent(fileName) != null; }
getCurrentDirectory(): string { return '/'; }
getDefaultLibFileName(options: ts.CompilerOptions): string { return 'lib.d.ts'; }
@ -91,8 +93,10 @@ export class MockNode implements ts.Node {
getText(sourceFile?: ts.SourceFile): string { return ''; }
getFirstToken(sourceFile?: ts.SourceFile): ts.Node { return null as any as ts.Node; }
getLastToken(sourceFile?: ts.SourceFile): ts.Node { return null as any as ts.Node; }
forEachChild<T>(cbNode: (node: ts.Node) => T, cbNodeArray?: (nodes: ts.Node[]) => T): T {
return null as any as T;
forEachChild<T>(
cbNode: (node: ts.Node) => T | undefined,
cbNodeArray?: (nodes: ts.NodeArray<ts.Node>) => T | undefined): T|undefined {
return undefined;
}
}
@ -105,6 +109,7 @@ export class MockIdentifier extends MockNode implements ts.Identifier {
public _incrementExpressionBrand: any;
public _unaryExpressionBrand: any;
public _expressionBrand: any;
public _updateExpressionBrand: any;
// tslint:enable
constructor(
@ -149,9 +154,11 @@ export class MockSymbol implements ts.Symbol {
export function expectNoDiagnostics(diagnostics: ts.Diagnostic[]) {
for (const diagnostic of diagnostics) {
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
const {line, character} = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
// tslint:disable-next-line:no-console
console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
if (diagnostic.file && diagnostic.start) {
const {line, character} = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
// tslint:disable-next-line:no-console
console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
}
}
expect(diagnostics.length).toBe(0);
}
@ -164,14 +171,8 @@ export function expectValidSources(service: ts.LanguageService, program: ts.Prog
}
}
export function allChildren<T>(node: ts.Node, cb: (node: ts.Node) => T): T {
return ts.forEachChild(node, child => {
const result = cb(node);
if (result) {
return result;
}
return allChildren(child, cb);
});
export function allChildren<T>(node: ts.Node, cb: (node: ts.Node) => T | undefined): T|undefined {
return ts.forEachChild(node, child => cb(node) || allChildren(child, cb));
}
export function findClass(sourceFile: ts.SourceFile, name: string): ts.ClassDeclaration|undefined {