feat(compiler-cli): add support for TypeScript 4.0 (#38076)

With this change we add support for TypeScript 4.0

PR Close #38076
This commit is contained in:
Alan Agius
2020-07-15 12:21:04 +02:00
committed by Misko Hevery
parent 201a546af8
commit 0fc44e0436
37 changed files with 315 additions and 141 deletions

View File

@ -584,7 +584,7 @@ describe('downlevel decorator transform', () => {
const visitNode = (node: ts.Node): ts.Node => {
if (ts.isClassDeclaration(node) || ts.isClassElement(node)) {
const cloned = ts.getMutableClone(node);
cloned.decorators = undefined;
(cloned.decorators as undefined) = undefined;
return cloned;
}
return ts.visitEachChild(node, visitNode, context);

View File

@ -492,11 +492,11 @@ describe('ng program', () => {
.toBe(true);
switch (checks.shouldBe) {
case ShouldBe.Empty:
expect(writeData!.data).toMatch(/^(\s*\/\*([^*]|\*[^/])*\*\/\s*)?$/);
expect(writeData!.data).toMatch(/^(\s*\/\*([^*]|\*[^\/])*\*\/\s*)?$/);
break;
case ShouldBe.EmptyExport:
expect(writeData!.data)
.toMatch(/^((\s*\/\*([^*]|\*[^/])*\*\/\s*)|(\s*export\s*{\s*}\s*;\s*)|())$/);
.toMatch(/^((\s*\/\*([^*]|\*[^\/])*\*\/\s*)|(\s*export\s*{\s*};\s*))$/m);
break;
case ShouldBe.NoneEmpty:
expect(writeData!.data).not.toBe('');
@ -505,12 +505,14 @@ describe('ng program', () => {
}
assertGenFile(
'built/src/util.ngfactory.js', {originalFileName: 'src/util.ts', shouldBe: ShouldBe.Empty});
'built/src/util.ngfactory.js',
{originalFileName: 'src/util.ts', shouldBe: ShouldBe.EmptyExport});
assertGenFile(
'built/src/util.ngfactory.d.ts',
{originalFileName: 'src/util.ts', shouldBe: ShouldBe.EmptyExport});
assertGenFile(
'built/src/util.ngsummary.js', {originalFileName: 'src/util.ts', shouldBe: ShouldBe.Empty});
'built/src/util.ngsummary.js',
{originalFileName: 'src/util.ts', shouldBe: ShouldBe.EmptyExport});
assertGenFile(
'built/src/util.ngsummary.d.ts',
{originalFileName: 'src/util.ts', shouldBe: ShouldBe.EmptyExport});
@ -987,7 +989,8 @@ describe('ng program', () => {
const errorDiags =
program1.emit().diagnostics.filter(d => d.category === ts.DiagnosticCategory.Error);
expect(stripAnsi(formatDiagnostics(errorDiags)))
.toContain(`src/main.ts:5:13 - error TS2322: Type '1' is not assignable to type 'string'.`);
.toContain(
`src/main.ts:5:13 - error TS2322: Type 'number' is not assignable to type 'string'.`);
expect(stripAnsi(formatDiagnostics(errorDiags)))
.toContain(
`src/main.html:1:1 - error TS100: Property 'nonExistent' does not exist on type 'MyComp'.`);