@@ -22,14 +22,19 @@ describe('Constructor Parameter Transformer', () => {
22
22
const input = `
23
23
export class ClassInject {};
24
24
25
+ @Injectable()
25
26
export class MyService {
26
27
constructor(v: ClassInject) {}
27
28
}
28
29
` ;
29
30
30
31
const output = `
32
+ import * as tslib_1 from "tslib";
31
33
export class ClassInject { } ;
32
- export class MyService { constructor(v) { } } MyService.ctorParameters = () => [ { type: ClassInject } ];
34
+ let MyService = class MyService { constructor(v) { } };
35
+ MyService.ctorParameters = () => [ { type: ClassInject } ];
36
+ MyService = tslib_1.__decorate([ Injectable() ], MyService);
37
+ export { MyService };
33
38
` ;
34
39
35
40
const result = transform ( input ) ;
@@ -47,19 +52,22 @@ describe('Constructor Parameter Transformer', () => {
47
52
constructor() { }
48
53
}
49
54
55
+ @Injectable()
50
56
export class MyService {
51
57
constructor(v: RootProvidedService) {}
52
58
}
53
59
` ;
54
60
55
- // tslint:disable:max-line-length
56
61
const output = `
57
62
import * as tslib_1 from "tslib";
58
63
let RootProvidedService = class RootProvidedService { constructor() { } };
59
64
RootProvidedService = tslib_1.__decorate([ Injectable({ providedIn: 'root' }) ], RootProvidedService);
60
- export { RootProvidedService }; export class MyService { constructor(v) { } } MyService.ctorParameters = () => [ { type: RootProvidedService } ];
65
+ export { RootProvidedService };
66
+ let MyService = class MyService { constructor(v) { } };
67
+ MyService.ctorParameters = () => [ { type: RootProvidedService } ];
68
+ MyService = tslib_1.__decorate([ Injectable() ], MyService);
69
+ export { MyService };
61
70
` ;
62
- // tslint:enable:max-line-length
63
71
64
72
const result = transform ( input ) ;
65
73
@@ -84,6 +92,7 @@ describe('Constructor Parameter Transformer', () => {
84
92
const input = `
85
93
import { RootProvidedService } from './root-provided-service';
86
94
95
+ @Injectable()
87
96
export class MyService {
88
97
constructor(v: RootProvidedService) {}
89
98
}
@@ -101,6 +110,7 @@ describe('Constructor Parameter Transformer', () => {
101
110
export interface InterInject {}
102
111
export const INTERFACE_INJECT = new InjectionToken<InterInject>('interface-inject');
103
112
113
+ @Injectable()
104
114
export class MyService {
105
115
constructor(@Inject(INTERFACE_INJECT) v: InterInject) {}
106
116
}
@@ -111,7 +121,7 @@ describe('Constructor Parameter Transformer', () => {
111
121
export const INTERFACE_INJECT = new InjectionToken('interface-inject');
112
122
let MyService = class MyService { constructor(v) { } };
113
123
MyService.ctorParameters = () => [ { type: undefined, decorators: [{ type: Inject, args: [INTERFACE_INJECT,] }] } ];
114
- MyService = tslib_1.__decorate([ tslib_1.__param(0, Inject(INTERFACE_INJECT)) ], MyService);
124
+ MyService = tslib_1.__decorate([ Injectable(), tslib_1.__param(0, Inject(INTERFACE_INJECT)) ], MyService);
115
125
export { MyService };
116
126
` ;
117
127
@@ -125,6 +135,7 @@ describe('Constructor Parameter Transformer', () => {
125
135
interface InterInject {}
126
136
export const INTERFACE_INJECT = new InjectionToken<InterInject>('interface-inject');
127
137
138
+ @Injectable()
128
139
export class MyService {
129
140
constructor(@Inject(INTERFACE_INJECT) v: InterInject) {}
130
141
}
@@ -135,7 +146,7 @@ describe('Constructor Parameter Transformer', () => {
135
146
export const INTERFACE_INJECT = new InjectionToken('interface-inject');
136
147
let MyService = class MyService { constructor(v) { } };
137
148
MyService.ctorParameters = () => [ { type: undefined, decorators: [{ type: Inject, args: [INTERFACE_INJECT,] }] } ];
138
- MyService = tslib_1.__decorate([ tslib_1.__param(0, Inject(INTERFACE_INJECT)) ], MyService);
149
+ MyService = tslib_1.__decorate([ Injectable(), tslib_1.__param(0, Inject(INTERFACE_INJECT)) ], MyService);
139
150
export { MyService };
140
151
` ;
141
152
@@ -155,6 +166,7 @@ describe('Constructor Parameter Transformer', () => {
155
166
const input = `
156
167
import { INTERFACE_INJECT, InterInject } from './module-inject';
157
168
169
+ @Injectable()
158
170
export class MyService {
159
171
constructor(@Inject(INTERFACE_INJECT) v: InterInject) {}
160
172
}
@@ -165,7 +177,7 @@ describe('Constructor Parameter Transformer', () => {
165
177
import { INTERFACE_INJECT } from './module-inject';
166
178
let MyService = class MyService { constructor(v) { } };
167
179
MyService.ctorParameters = () => [ { type: undefined, decorators: [{ type: Inject, args: [INTERFACE_INJECT,] }] } ];
168
- MyService = tslib_1.__decorate([ tslib_1.__param(0, Inject(INTERFACE_INJECT)) ], MyService);
180
+ MyService = tslib_1.__decorate([ Injectable(), tslib_1.__param(0, Inject(INTERFACE_INJECT)) ], MyService);
169
181
export { MyService };
170
182
` ;
171
183
0 commit comments