Skip to content

Commit 125df99

Browse files
alan-agius4filipesilva
authored andcommitted
build: update to TypeScript 3.9.5
1 parent 057411d commit 125df99

File tree

10 files changed

+204
-345
lines changed

10 files changed

+204
-345
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
"tslint": "^6.0.0",
221221
"tslint-no-circular-imports": "^0.7.0",
222222
"tslint-sonarts": "1.9.0",
223-
"typescript": "3.9.3",
223+
"typescript": "3.9.5",
224224
"verdaccio": "4.5.1",
225225
"webpack": "4.42.1",
226226
"webpack-dev-middleware": "3.7.2",

packages/ngtools/webpack/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
"webpack": "^4.0.0"
3333
},
3434
"devDependencies": {
35-
"@angular/compiler": "10.0.0-rc.0",
36-
"@angular/compiler-cli": "10.0.0-rc.0",
37-
"typescript": "3.9.3",
35+
"@angular/compiler": "10.0.0-rc.2",
36+
"@angular/compiler-cli": "10.0.0-rc.2",
37+
"typescript": "3.9.5",
3838
"webpack": "4.42.1"
3939
}
4040
}

packages/ngtools/webpack/src/transformers/ctor-parameters_spec.ts

Lines changed: 30 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,9 @@ describe('Constructor Parameter Transformer', () => {
3232
const output = `
3333
import { __decorate } from "tslib";
3434
export class ClassInject { } ;
35-
let MyService = /** @class */ (() => {
36-
let MyService = class MyService { constructor(v) { } };
37-
MyService.ctorParameters = () => [ { type: ClassInject } ];
38-
MyService = __decorate([ Injectable() ], MyService);
39-
return MyService;
40-
})();
35+
let MyService = class MyService { constructor(v) { } };
36+
MyService.ctorParameters = () => [ { type: ClassInject } ];
37+
MyService = __decorate([ Injectable() ], MyService);
4138
export { MyService };
4239
`;
4340

@@ -83,19 +80,12 @@ describe('Constructor Parameter Transformer', () => {
8380

8481
const output = `
8582
import { __decorate } from "tslib";
86-
87-
let RootProvidedService = /** @class */ (() => {
88-
let RootProvidedService = class RootProvidedService { constructor() { } };
89-
RootProvidedService = __decorate([ Injectable({ providedIn: 'root' }) ], RootProvidedService);
90-
return RootProvidedService;
91-
})();
83+
let RootProvidedService = class RootProvidedService { constructor() { } };
84+
RootProvidedService = __decorate([ Injectable({ providedIn: 'root' }) ], RootProvidedService);
9285
export { RootProvidedService };
93-
let MyService = /** @class */ (() => {
94-
let MyService = class MyService { constructor(v) { } };
95-
MyService.ctorParameters = () => [ { type: RootProvidedService } ];
96-
MyService = __decorate([ Injectable() ], MyService);
97-
return MyService;
98-
})();
86+
let MyService = class MyService { constructor(v) { } };
87+
MyService.ctorParameters = () => [ { type: RootProvidedService } ];
88+
MyService = __decorate([ Injectable() ], MyService);
9989
export { MyService };
10090
`;
10191

@@ -128,12 +118,12 @@ describe('Constructor Parameter Transformer', () => {
128118
const output = `
129119
import { __decorate } from "tslib";
130120
import { RootProvidedService } from './root-provided-service';
131-
let MyService = /** @class */ (() => {
132-
let MyService = class MyService { constructor(v) { } };
133-
MyService.ctorParameters = () => [ { type: RootProvidedService } ];
134-
MyService = __decorate([ Injectable() ], MyService);
135-
return MyService;
136-
})();
121+
122+
let MyService = class MyService {
123+
constructor(v) { }
124+
};
125+
MyService.ctorParameters = () => [ { type: RootProvidedService } ];
126+
MyService = __decorate([ Injectable() ], MyService);
137127
export { MyService };
138128
`;
139129

@@ -156,11 +146,9 @@ describe('Constructor Parameter Transformer', () => {
156146
const output = `
157147
import { __decorate, __param } from "tslib";
158148
export const INTERFACE_INJECT = new InjectionToken('interface-inject');
159-
let MyService = /** @class */ (() => {
160-
let MyService = class MyService { constructor(v) { } }; MyService.ctorParameters = () => [ { type: undefined, decorators: [{ type: Inject, args: [INTERFACE_INJECT,] }] } ];
161-
MyService = __decorate([ Injectable(), __param(0, Inject(INTERFACE_INJECT)) ], MyService);
162-
return MyService;
163-
})();
149+
let MyService = class MyService { constructor(v) { } };
150+
MyService.ctorParameters = () => [ { type: undefined, decorators: [{ type: Inject, args: [INTERFACE_INJECT,] }] } ];
151+
MyService = __decorate([ Injectable(), __param(0, Inject(INTERFACE_INJECT)) ], MyService);
164152
export { MyService };
165153
`;
166154

@@ -183,12 +171,9 @@ describe('Constructor Parameter Transformer', () => {
183171
const output = `
184172
import { __decorate, __param } from "tslib";
185173
export const INTERFACE_INJECT = new InjectionToken('interface-inject');
186-
let MyService = /** @class */ (() => {
187-
let MyService = class MyService { constructor(v) { } };
188-
MyService.ctorParameters = () => [ { type: undefined, decorators: [{ type: Inject, args: [INTERFACE_INJECT,] }] } ];
189-
MyService = __decorate([ Injectable(), __param(0, Inject(INTERFACE_INJECT)) ], MyService);
190-
return MyService;
191-
})();
174+
let MyService = class MyService { constructor(v) { } };
175+
MyService.ctorParameters = () => [ { type: undefined, decorators: [{ type: Inject, args: [INTERFACE_INJECT,] }] } ];
176+
MyService = __decorate([ Injectable(), __param(0, Inject(INTERFACE_INJECT)) ], MyService);
192177
export { MyService };
193178
`;
194179

@@ -217,12 +202,9 @@ describe('Constructor Parameter Transformer', () => {
217202
const output = `
218203
import { __decorate, __param } from "tslib";
219204
import { INTERFACE_INJECT } from './module-inject';
220-
let MyService = /** @class */ (() => {
221-
let MyService = class MyService { constructor(v) { } };
222-
MyService.ctorParameters = () => [ { type: undefined, decorators: [{ type: Inject, args: [INTERFACE_INJECT,] }] } ];
223-
MyService = __decorate([ Injectable(), __param(0, Inject(INTERFACE_INJECT)) ], MyService);
224-
return MyService;
225-
})();
205+
let MyService = class MyService { constructor(v) { } };
206+
MyService.ctorParameters = () => [ { type: undefined, decorators: [{ type: Inject, args: [INTERFACE_INJECT,] }] } ];
207+
MyService = __decorate([ Injectable(), __param(0, Inject(INTERFACE_INJECT)) ], MyService);
226208
export { MyService };
227209
`;
228210

@@ -250,25 +232,15 @@ describe('Constructor Parameter Transformer', () => {
250232
const output = `
251233
import { __decorate, __param } from "tslib";
252234
253-
let ProvidedService = /** @class */ (() => {
254-
let ProvidedService = class ProvidedService {
255-
constructor() { }
256-
};
257-
ProvidedService = __decorate([ Injectable() ], ProvidedService);
258-
return ProvidedService;
259-
})();
235+
let ProvidedService = class ProvidedService { constructor() { } };
236+
ProvidedService = __decorate([ Injectable() ], ProvidedService);
260237
export { ProvidedService };
261238
262-
let LibService = /** @class */ (() => {
263-
let LibService = class LibService {
264-
constructor(service) {
265-
this.service = service;
266-
}
267-
};
268-
LibService.ctorParameters = () => [ { type: ProvidedService, decorators: [{ type: Optional }] } ];
269-
LibService = __decorate([ Injectable(), __param(0, Optional()) ], LibService);
270-
return LibService;
271-
})();
239+
let LibService = class LibService {
240+
constructor(service) { this.service = service; }
241+
};
242+
LibService.ctorParameters = () => [ { type: ProvidedService, decorators: [{ type: Optional }] } ];
243+
LibService = __decorate([ Injectable(), __param(0, Optional()) ], LibService);
272244
export { LibService };
273245
`;
274246

packages/ngtools/webpack/src/transformers/elide_imports_spec.ts

Lines changed: 19 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,8 @@ describe('@ngtools/webpack transformers', () => {
326326
import { __decorate } from "tslib";
327327
import { Decorator } from './decorator';
328328
329-
let Foo = /** @class */ (() => {
330-
let Foo = class Foo { constructor(param) { } };
331-
Foo = __decorate([ Decorator() ], Foo); return Foo;
332-
})();
329+
let Foo = class Foo { constructor(param) { } };
330+
Foo = __decorate([ Decorator() ], Foo);
333331
export { Foo };
334332
`;
335333

@@ -365,11 +363,8 @@ describe('@ngtools/webpack transformers', () => {
365363
import { Decorator } from './decorator';
366364
import { Service } from './service';
367365
368-
let Foo = /** @class */ (() => {
369-
let Foo = class Foo { constructor(param) { } };
370-
Foo = __decorate([ Decorator(), __metadata("design:paramtypes", [Service]) ], Foo);
371-
return Foo;
372-
})();
366+
let Foo = class Foo { constructor(param) { } };
367+
Foo = __decorate([ Decorator(), __metadata("design:paramtypes", [Service]) ], Foo);
373368
export { Foo };
374369
`;
375370

@@ -394,13 +389,11 @@ describe('@ngtools/webpack transformers', () => {
394389
const output = tags.stripIndent`
395390
import { __decorate, __metadata } from "tslib";
396391
import { Decorator } from './decorator';
392+
397393
import { Service } from './service';
398-
let Foo = /** @class */ (() => {
399-
class Foo { }
400-
__decorate([ Decorator(), __metadata("design:type", Service) ], Foo.prototype, "foo", void 0);
401-
return Foo;
402-
})();
403-
export { Foo };
394+
395+
export class Foo { }
396+
__decorate([ Decorator(), __metadata("design:type", Service) ], Foo.prototype, "foo", void 0);
404397
`;
405398

406399
const { program, compilerHost } = createTypescriptContext(input, additionalFiles, true, extraCompilerOptions);
@@ -431,13 +424,8 @@ describe('@ngtools/webpack transformers', () => {
431424
import { Decorator } from './decorator';
432425
import { Service } from './service';
433426
434-
let Foo = /** @class */ (() => {
435-
class Foo { set name(f) { this._foo = f; } }
436-
__decorate([ Decorator(), __metadata("design:type", Service), __metadata("design:paramtypes", [Service]) ], Foo.prototype, "name", null);
437-
return Foo;
438-
})();
439-
440-
export { Foo };
427+
export class Foo { set name(f) { this._foo = f; } }
428+
__decorate([ Decorator(), __metadata("design:type", Service), __metadata("design:paramtypes", [Service]) ], Foo.prototype, "name", null);
441429
`;
442430

443431
const { program, compilerHost } = createTypescriptContext(input, additionalFiles, true, extraCompilerOptions);
@@ -468,12 +456,8 @@ describe('@ngtools/webpack transformers', () => {
468456
import { Decorator } from './decorator';
469457
import { Service } from './service';
470458
471-
let Foo = /** @class */ (() => {
472-
class Foo { get name() { return this._foo; } }
473-
__decorate([ Decorator(), __metadata("design:type", Service), __metadata("design:paramtypes", []) ], Foo.prototype, "name", null);
474-
return Foo;
475-
})();
476-
export { Foo };
459+
export class Foo { get name() { return this._foo; } }
460+
__decorate([ Decorator(), __metadata("design:type", Service), __metadata("design:paramtypes", []) ], Foo.prototype, "name", null);
477461
`;
478462

479463
const { program, compilerHost } = createTypescriptContext(input, additionalFiles, true, extraCompilerOptions);
@@ -502,12 +486,9 @@ describe('@ngtools/webpack transformers', () => {
502486
import { Decorator } from './decorator';
503487
import { Service } from './service';
504488
505-
let Foo = /** @class */ (() => {
506-
class Foo { name() { return undefined; } }
507-
__decorate([ Decorator(), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Service) ], Foo.prototype, "name", null);
508-
return Foo;
509-
})();
510-
export { Foo };
489+
export class Foo { name() { return undefined; } }
490+
__decorate([ Decorator(), __metadata("design:type", Function),
491+
__metadata("design:paramtypes", []), __metadata("design:returntype", Service) ], Foo.prototype, "name", null);
511492
`;
512493

513494
const { program, compilerHost } = createTypescriptContext(input, additionalFiles, true, extraCompilerOptions);
@@ -536,12 +517,10 @@ describe('@ngtools/webpack transformers', () => {
536517
import { Decorator } from './decorator';
537518
import { Service } from './service';
538519
539-
let Foo = /** @class */ (() => {
540-
class Foo { name(f) { } }
541-
__decorate([ Decorator(), __metadata("design:type", Function), __metadata("design:paramtypes", [Service]), __metadata("design:returntype", void 0) ], Foo.prototype, "name", null);
542-
return Foo;
543-
})();
544-
export { Foo };
520+
export class Foo { name(f) { } }
521+
522+
__decorate([ Decorator(), __metadata("design:type", Function), __metadata("design:paramtypes", [Service]),
523+
__metadata("design:returntype", void 0) ], Foo.prototype, "name", null);
545524
`;
546525

547526
const { program, compilerHost } = createTypescriptContext(input, additionalFiles, true, extraCompilerOptions);

packages/ngtools/webpack/src/transformers/remove_decorators_spec.ts

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,18 @@ describe('@ngtools/webpack transformers', () => {
5959
const output = `
6060
import { __decorate } from "tslib";
6161
import { Component } from 'another-lib';
62-
63-
let AppComponent = /** @class */ (() => {
64-
let AppComponent = class AppComponent {
62+
let AppComponent = class AppComponent {
6563
constructor() {
66-
this.title = 'app';
64+
this.title = 'app';
6765
}
68-
};
69-
AppComponent = __decorate([
70-
Component({
66+
};
67+
AppComponent = __decorate([
68+
Component({
7169
selector: 'app-root',
7270
templateUrl: './app.component.html',
7371
styleUrls: ['./app.component.css']
74-
})
75-
], AppComponent);
76-
return AppComponent;
77-
})();
72+
})
73+
], AppComponent);
7874
export { AppComponent };
7975
`;
8076

@@ -112,21 +108,18 @@ describe('@ngtools/webpack transformers', () => {
112108
import { __decorate } from "tslib";
113109
import { AnotherDecorator } from 'another-lib';
114110
115-
let AppComponent = /** @class */ (() => {
116-
class AppComponent {
117-
constructor() {
111+
export class AppComponent {
112+
constructor() {
118113
this.title = 'app';
119-
}
120-
onEscape() {
121-
console.log('run');
122-
}
123114
}
124-
__decorate([
125-
AnotherDecorator()
126-
], AppComponent.prototype, "onEscape", null);
127-
return AppComponent;
128-
})();
129-
export { AppComponent };
115+
116+
onEscape() {
117+
console.log('run');
118+
}
119+
}
120+
__decorate([
121+
AnotherDecorator()
122+
], AppComponent.prototype, "onEscape", null);
130123
`;
131124

132125
const { program, compilerHost } = createTypescriptContext(input);
@@ -158,17 +151,14 @@ describe('@ngtools/webpack transformers', () => {
158151
import { __decorate } from "tslib";
159152
import { AnotherDecorator } from 'another-lib';
160153
161-
let AppComponent = /** @class */ (() => {
162-
let AppComponent = class AppComponent {
163-
constructor() {
154+
let AppComponent = class AppComponent {
155+
constructor() {
164156
this.title = 'app';
165-
}
166-
};
167-
AppComponent = __decorate([
168-
AnotherDecorator()
169-
], AppComponent);
170-
return AppComponent;
171-
})();
157+
}
158+
};
159+
AppComponent = __decorate([
160+
AnotherDecorator()
161+
], AppComponent);
172162
export { AppComponent };
173163
`;
174164

0 commit comments

Comments
 (0)