Skip to content
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

build: upgrade to TypeScript 2.7 #22097

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.5.5",
"rxjs": "5.5.6",
"tslib": "^1.7.1",
"zone.js": "^0.8.12"
},
Expand Down Expand Up @@ -103,7 +103,7 @@
"tslint": "5.7.0",
"tslint-eslint-rules": "4.1.1",
"tsutils": "2.12.1",
"typescript": "2.6.x",
"typescript": "2.7.x",
"uglify-js": "2.8.29",
"universal-analytics": "0.4.15",
"vlq": "0.2.2",
Expand Down
4 changes: 3 additions & 1 deletion packages/compiler-cli/src/diagnostics/typescript_symbols.ts
Expand Up @@ -46,7 +46,9 @@ export function getClassMembers(
if (declaration) {
const type = checker.getTypeAtLocation(declaration);
const node = program.getSourceFile(staticSymbol.filePath);
return new TypeWrapper(type, {node, program, checker}).members();
if (node) {
return new TypeWrapper(type, {node, program, checker}).members();
}
}
}

Expand Down
9 changes: 6 additions & 3 deletions packages/compiler-cli/src/transformers/lower_expressions.ts
Expand Up @@ -190,9 +190,12 @@ export function getExpressionLoweringTransformFactory(
// Return the factory
return (context: ts.TransformationContext) => (sourceFile: ts.SourceFile): ts.SourceFile => {
// We need to use the original SourceFile for reading metadata, and not the transformed one.
const requests = requestsMap.getRequests(program.getSourceFile(sourceFile.fileName));
if (requests && requests.size) {
return transformSourceFile(sourceFile, requests, context);
const originalFile = program.getSourceFile(sourceFile.fileName);
if (originalFile) {
const requests = requestsMap.getRequests(originalFile);
if (requests && requests.size) {
return transformSourceFile(sourceFile, requests, context);
}
}
return sourceFile;
};
Expand Down
5 changes: 4 additions & 1 deletion packages/compiler-cli/src/transformers/program.ts
Expand Up @@ -299,7 +299,10 @@ class AngularCompilerProgram implements Program {
genFile = genFileByFileName.get(sourceFile.fileName);
if (!sourceFile.isDeclarationFile && !GENERATED_FILES.test(sourceFile.fileName)) {
// Note: sourceFile is the transformed sourcefile, not the original one!
emittedSourceFiles.push(this.tsProgram.getSourceFile(sourceFile.fileName));
const originalFile = this.tsProgram.getSourceFile(sourceFile.fileName);
if (originalFile) {
emittedSourceFiles.push(originalFile);
}
}
}
this.writeFile(outFileName, outData, writeByteOrderMark, onError, genFile, sourceFiles);
Expand Down
22 changes: 12 additions & 10 deletions packages/compiler-cli/test/diagnostics/mocks.ts
Expand Up @@ -240,16 +240,18 @@ export function getDiagnosticTemplateInfo(
const members = getClassMembers(context.program, context.checker, type);
if (members) {
const sourceFile = context.program.getSourceFile(type.filePath);
const query = getSymbolQuery(
context.program, context.checker, sourceFile,
() =>
getPipesTable(sourceFile, context.program, context.checker, compiledTemplate.pipes));
return {
fileName: templateFile,
offset: 0, query, members,
htmlAst: compiledTemplate.htmlAst,
templateAst: compiledTemplate.templateAst
};
if (sourceFile) {
const query = getSymbolQuery(
context.program, context.checker, sourceFile,
() => getPipesTable(
sourceFile, context.program, context.checker, compiledTemplate.pipes));
return {
fileName: templateFile,
offset: 0, query, members,
htmlAst: compiledTemplate.htmlAst,
templateAst: compiledTemplate.templateAst
};
}
}
}
}
Expand Down
Expand Up @@ -41,7 +41,7 @@ describe('symbol query', () => {
const service = ts.createLanguageService(host, registry);
program = service.getProgram();
checker = program.getTypeChecker();
sourceFile = program.getSourceFile('/quickstart/app/app.component.ts');
sourceFile = program.getSourceFile('/quickstart/app/app.component.ts') !;
const options: CompilerOptions = Object.create(host.getCompilationSettings());
options.genDir = '/dist';
options.basePath = '/quickstart';
Expand Down