Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration/bazel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@bazel/protractor": "0.37.1",
"@bazel/typescript": "0.37.1",
"@types/jasmine": "2.8.8",
"typescript": "3.4.2"
"typescript": "3.6.3"
},
"scripts": {
"test": "bazel build ... --noshow_progress && bazel test ...",
Expand Down
24 changes: 0 additions & 24 deletions integration/typings_test_ts34/tsconfig.json

This file was deleted.

77 changes: 0 additions & 77 deletions integration/typings_test_ts35/include-all.ts

This file was deleted.

30 changes: 0 additions & 30 deletions integration/typings_test_ts35/package.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-integration",
"description": "Assert that users with TypeScript 3.3 can type-check an Angular application",
"description": "Assert that users with TypeScript 3.6 can type-check an Angular application",
"version": "0.0.0",
"license": "MIT",
"dependencies": {
Expand All @@ -21,7 +21,7 @@
"@angular/upgrade": "file:../../dist/packages-dist/upgrade",
"@types/jasmine": "2.5.41",
"rxjs": "file:../../node_modules/rxjs",
"typescript": "3.4.2",
"typescript": "3.6.3",
"zone.js": "file:../../node_modules/zone.js"
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../../dist/typings_test_ts35/",
"outDir": "../../dist/typings_test_ts36/",
"rootDir": ".",
"target": "es5",
"lib": [
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@
"source-map": "^0.6.1",
"source-map-support": "0.5.9",
"systemjs": "0.18.10",
"tsickle": "0.36.0",
"tsickle": "0.37.0",
"tslib": "^1.9.0",
"tslint": "5.7.0",
"typescript": "~3.5.3",
"typescript": "~3.6.3",
"xhr2": "0.1.4",
"yargs": "13.1.0",
"zone.js": "^0.10.2"
Expand Down
4 changes: 2 additions & 2 deletions packages/bazel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
"@types/node": "6.0.84",
"semver": "^5.6.0",
"shelljs": "0.8.2",
"tsickle": "^0.35.0"
"tsickle": "^0.37.0"
},
"peerDependencies": {
"@angular/compiler-cli": "0.0.0-PLACEHOLDER",
"@bazel/typescript": "0.*",
"typescript": ">=3.4 <3.6"
"typescript": ">=3.6 <3.7"
},
"repository": {
"type": "git",
Expand Down
13 changes: 5 additions & 8 deletions packages/compiler-cli/ngcc/src/host/commonjs_host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,13 @@ export class CommonJsReflectionHost extends Esm5ReflectionHost {
private resolveModuleName(moduleName: string, containingFile: ts.SourceFile): ts.SourceFile
|undefined {
if (this.compilerHost.resolveModuleNames) {
// FIXME: remove the "as any" cast once on TS3.6.
const moduleInfo = (this.compilerHost as any)
.resolveModuleNames(
[moduleName], containingFile.fileName, undefined, undefined,
this.program.getCompilerOptions())[0];
const moduleInfo = this.compilerHost.resolveModuleNames(
[moduleName], containingFile.fileName, undefined, undefined,
this.program.getCompilerOptions())[0];
return moduleInfo && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedFileName));
} else {
const moduleInfo = ts.resolveModuleName(
moduleName, containingFile.fileName, this.program.getCompilerOptions(),
this.compilerHost);
const moduleInfo =
ts.resolveModuleName(moduleName, containingFile.fileName, this.program.getCompilerOptions(), this.compilerHost);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

resolveModuleName now takes the compiler options before the ModuleResolutionHost.

return moduleInfo.resolvedModule &&
this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedModule.resolvedFileName));
}
Expand Down
8 changes: 3 additions & 5 deletions packages/compiler-cli/ngcc/src/host/umd_host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,9 @@ export class UmdReflectionHost extends Esm5ReflectionHost {
private resolveModuleName(moduleName: string, containingFile: ts.SourceFile): ts.SourceFile
|undefined {
if (this.compilerHost.resolveModuleNames) {
// FIXME: remove the "as any" cast once on TS3.6.
const moduleInfo = (this.compilerHost as any)
.resolveModuleNames(
[moduleName], containingFile.fileName, undefined, undefined,
this.program.getCompilerOptions())[0];
const moduleInfo = this.compilerHost.resolveModuleNames(
[moduleName], containingFile.fileName, undefined, undefined,
this.program.getCompilerOptions())[0];
return moduleInfo && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedFileName));
} else {
const moduleInfo = ts.resolveModuleName(
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"peerDependencies": {
"@angular/compiler": "0.0.0-PLACEHOLDER",
"typescript": ">=3.4 <3.6"
"typescript": ">=3.6 <3.7"
},
"engines": {
"node": ">=8.0"
Expand Down
18 changes: 10 additions & 8 deletions packages/compiler-cli/src/ngtsc/shims/src/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,11 @@ export interface ShimGenerator {
export class GeneratedShimsHostWrapper implements ts.CompilerHost {
constructor(private delegate: ts.CompilerHost, private shimGenerators: ShimGenerator[]) {
if (delegate.resolveModuleNames !== undefined) {
// FIXME: TypeScript 3.6 adds an "options" argument that the code below passes on, but which
// still makes the method incompatible with TS3.5. Remove the "as any" cast once fully on 3.6.
((this as ts.CompilerHost) as any).resolveModuleNames =
(moduleNames: string[], containingFile: string, reusedNames: (string[] | undefined),
redirectedReference: (ts.ResolvedProjectReference | undefined), options: any) =>
(delegate as any)
.resolveModuleNames !(
moduleNames, containingFile, reusedNames, redirectedReference, options);
this.resolveModuleNames =
(moduleNames: string[], containingFile: string, reusedNames: string[],
redirectedReference: ts.ResolvedProjectReference, options: ts.CompilerOptions) =>
delegate.resolveModuleNames !(
moduleNames, containingFile, reusedNames, redirectedReference, options);
}
if (delegate.resolveTypeReferenceDirectives) {
// Backward compatibility with TypeScript 2.9 and older since return
Expand All @@ -59,6 +56,11 @@ export class GeneratedShimsHostWrapper implements ts.CompilerHost {
}
}

resolveModuleNames?:
(moduleNames: string[], containingFile: string, reusedNames: string[],
redirectedReference: ts.ResolvedProjectReference,
options: ts.CompilerOptions) => (ts.ResolvedModule | undefined)[];

resolveTypeReferenceDirectives?:
(names: string[], containingFile: string) => ts.ResolvedTypeReferenceDirective[];

Expand Down
6 changes: 2 additions & 4 deletions packages/compiler-cli/src/ngtsc/util/src/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,8 @@ export function resolveModuleName(
moduleName: string, containingFile: string, compilerOptions: ts.CompilerOptions,
compilerHost: ts.CompilerHost): ts.ResolvedModule|undefined {
if (compilerHost.resolveModuleNames) {
// FIXME: Additional parameters are required in TS3.6, but ignored in 3.5.
// Remove the any cast once fully on TS3.6.
return (compilerHost as any)
.resolveModuleNames([moduleName], containingFile, undefined, undefined, compilerOptions)[0];
return compilerHost.resolveModuleNames(
[moduleName], containingFile, undefined, undefined, compilerOptions)[0];
} else {
return ts.resolveModuleName(moduleName, containingFile, compilerOptions, compilerHost)
.resolvedModule;
Expand Down
23 changes: 11 additions & 12 deletions packages/compiler-cli/src/perform_compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,22 @@ export function formatDiagnosticPosition(
}

export function flattenDiagnosticMessageChain(
chain: api.DiagnosticMessageChain, host: ts.FormatDiagnosticsHost = defaultFormatHost): string {
let result = chain.messageText;
let indent = 1;
let current = chain.next;
chain: api.DiagnosticMessageChain, host: ts.FormatDiagnosticsHost = defaultFormatHost, indent = 0): string {
const newLine = host.getNewLine();
while (current) {
let result = "";
if (indent) {
result += newLine;

for (let i = 0; i < indent; i++) {
result += ' ';
result += " ";
}
result += current.messageText;
const position = current.position;
if (position) {
result += ` at ${formatDiagnosticPosition(position, host)}`;
}
result += chain.messageText;
indent++;
if (chain.next) {
for (const kid of chain.next) {
result += flattenDiagnosticMessageChain(kid, host, indent);
}
current = current.next;
indent++;
}
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/src/transformers/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const SOURCE = 'angular' as 'angular';
export interface DiagnosticMessageChain {
messageText: string;
position?: Position;
next?: DiagnosticMessageChain;
next?: DiagnosticMessageChain[];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ts.DiagnosticMessageChain is now a tree microsoft/TypeScript@ba9d8e2

}

export interface Diagnostic {
Expand Down
6 changes: 3 additions & 3 deletions packages/compiler-cli/src/transformers/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ const defaultEmitCallback: TsEmitCallback =
* Minimum supported TypeScript version
* ∀ supported typescript version v, v >= MIN_TS_VERSION
*/
const MIN_TS_VERSION = '3.4.0';
const MIN_TS_VERSION = '3.6.3';

/**
* Supremum of supported TypeScript versions
* ∀ supported typescript version v, v < MAX_TS_VERSION
* MAX_TS_VERSION is not considered as a supported TypeScript version
*/
const MAX_TS_VERSION = '3.6.0';
const MAX_TS_VERSION = '3.7.0';

class AngularCompilerProgram implements Program {
private rootNames: string[];
Expand Down Expand Up @@ -1109,7 +1109,7 @@ function diagnosticChainFromFormattedDiagnosticChain(chain: FormattedMessageChai
DiagnosticMessageChain {
return {
messageText: chain.message,
next: chain.next && diagnosticChainFromFormattedDiagnosticChain(chain.next),
next: chain.next && chain.next.map(diagnosticChainFromFormattedDiagnosticChain),
position: chain.position
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('expression diagnostics', () => {
if (typeof messageText == 'string') {
return messageText;
} else {
if (messageText.next) return messageText.messageText + messageToString(messageText.next);
if (messageText.next) return messageText.messageText + messageText.next.map(messageToString);
return messageText.messageText;
}
}
Expand Down
12 changes: 9 additions & 3 deletions packages/compiler/src/aot/formatted_error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface Position {
export interface FormattedMessageChain {
message: string;
position?: Position;
next?: FormattedMessageChain;
next?: FormattedMessageChain[];
}

export type FormattedError = Error & {
Expand All @@ -41,9 +41,15 @@ function formatChain(chain: FormattedMessageChain | undefined, indent: number =
'';
const prefix = position && indent === 0 ? `${position}: ` : '';
const postfix = position && indent !== 0 ? ` at ${position}` : '';
const message = `${prefix}${chain.message}${postfix}`;
let message = `${prefix}${chain.message}${postfix}`;

return `${indentStr(indent)}${message}${(chain.next && ('\n' + formatChain(chain.next, indent + 2))) || ''}`;
if (chain.next) {
for (const kid of chain.next) {
message += formatChain(kid, indent + 2);
}
}

return `${indentStr(indent)}${message}`;
}

export function formattedError(chain: FormattedMessageChain): FormattedError {
Expand Down
Loading