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

Allow compilation with TypeScript 2.5 #19966

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: 3 additions & 1 deletion packages/benchpress/src/runner.ts
Expand Up @@ -81,7 +81,9 @@ export class Runner {
{provide: WebDriverAdapter, useValue: adapter}
]);

const sampler = injector.get(Sampler);
// TODO: With TypeScript 2.5 injector.get does not infer correctly the
// return type. Remove 'any' and investigate the issue.
const sampler = injector.get(Sampler) as any;
return sampler.sample();
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/compiler-cli/src/metadata/collector.ts
Expand Up @@ -116,8 +116,8 @@ export class MetadataCollector {
function classMetadataOf(classDeclaration: ts.ClassDeclaration): ClassMetadata {
const result: ClassMetadata = {__symbolic: 'class'};

function getDecorators(decorators: ts.Decorator[] | undefined): MetadataSymbolicExpression[]|
undefined {
function getDecorators(decorators: ReadonlyArray<ts.Decorator>| undefined):
MetadataSymbolicExpression[]|undefined {
if (decorators && decorators.length)
return decorators.map(decorator => objFromDecorator(decorator));
return undefined;
Expand Down
6 changes: 4 additions & 2 deletions packages/compiler-cli/src/transformers/program.ts
Expand Up @@ -593,7 +593,8 @@ class AngularCompilerProgram implements Program {

private writeFile(
outFileName: string, outData: string, writeByteOrderMark: boolean,
onError?: (message: string) => void, genFile?: GeneratedFile, sourceFiles?: ts.SourceFile[]) {
onError?: (message: string) => void, genFile?: GeneratedFile,
sourceFiles?: ReadonlyArray<ts.SourceFile>) {
// collect emittedLibrarySummaries
let baseFile: ts.SourceFile|undefined;
if (genFile) {
Expand Down Expand Up @@ -640,7 +641,8 @@ class AngularCompilerProgram implements Program {
if (baseFile) {
sourceFiles = sourceFiles ? [...sourceFiles, baseFile] : [baseFile];
}
this.host.writeFile(outFileName, outData, writeByteOrderMark, onError, sourceFiles);
// TODO: remove any when TS 2.4 support is removed.
this.host.writeFile(outFileName, outData, writeByteOrderMark, onError, sourceFiles as any);
}
}

Expand Down
13 changes: 10 additions & 3 deletions packages/language-service/src/ts_plugin.ts
Expand Up @@ -179,7 +179,13 @@ export function create(info: any /* ts.server.PluginCreateInfo */): ts.LanguageS
}

function completionToEntry(c: Completion): ts.CompletionEntry {
return {kind: c.kind, name: c.name, sortText: c.sort, kindModifiers: ''};
return {
// TODO: remove any and fix type error.
kind: c.kind as any,
name: c.name,
sortText: c.sort,
kindModifiers: ''
};
}

function diagnosticToDiagnostic(d: Diagnostic, file: ts.SourceFile): ts.Diagnostic {
Expand Down Expand Up @@ -294,9 +300,10 @@ export function create(info: any /* ts.server.PluginCreateInfo */): ts.LanguageS
fileName: loc.fileName,
textSpan: {start: loc.span.start, length: loc.span.end - loc.span.start},
name: '',
kind: 'definition',
// TODO: remove any and fix type error.
kind: 'definition' as any,
containerName: loc.fileName,
containerKind: 'file'
containerKind: 'file' as any,
});
}
}
Expand Down