pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/angular/angular/commit/c457b9b5b49fa668c7880cf1908a5281a9601bf4

7560d244c08.css" /> refactor(compiler): add ts-ignore comment on factory functions · angular/angular@c457b9b · GitHub
Skip to content

Commit c457b9b

Browse files
crisbetomattrbeck
authored andcommitted
refactor(compiler): add ts-ignore comment on factory functions
Adds a `ts-ignore` comment to thew instantiation expressions in factories, because in some compilation modes we can't guarantee that they'll compile.
1 parent a8bf957 commit c457b9b

20 files changed

+111
-141
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
export class MyOtherPipe {
22
3-
static ɵfac = function MyOtherPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MyOtherPipe)($i0$.ɵɵdirectiveInject($i0$.ChangeDetectorRef, 24)); };
3+
static ɵfac = function MyOtherPipe_Factory(__ngFactoryType__) {
4+
/* @ts-ignore */
5+
return new (__ngFactoryType__ || MyOtherPipe)($i0$.ɵɵdirectiveInject($i0$.ChangeDetectorRef, 24));
6+
};
47
58
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
export class MyPipe {
22
3-
static ɵfac = function MyPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MyPipe)($i0$.ɵɵdirectiveInject($i0$.ChangeDetectorRef, 16)); };
3+
static ɵfac = function MyPipe_Factory(__ngFactoryType__) {
4+
/* @ts-ignore */
5+
return new (__ngFactoryType__ || MyPipe)($i0$.ɵɵdirectiveInject($i0$.ChangeDetectorRef, 16));
6+
};
47
58
}

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/template_variables/for_of_def.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export class ForOfDirective {
22
33
static ɵfac = function ForOfDirective_Factory(__ngFactoryType__) {
4+
/* @ts-ignore */
45
return new (__ngFactoryType__ || ForOfDirective)($r3$.ɵɵdirectiveInject($r3$.ViewContainerRef), $r3$.ɵɵdirectiveInject($r3$.TemplateRef));
56
};
67
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
export class IfDirective {
22
3-
static ɵfac = function IfDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || IfDirective)($r3$.ɵɵdirectiveInject($i$.TemplateRef)); };
3+
static ɵfac = function IfDirective_Factory(__ngFactoryType__) {
4+
/* @ts-ignore */
5+
return new (__ngFactoryType__ || IfDirective)($r3$.ɵɵdirectiveInject($i$.TemplateRef));
6+
};
47
58
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
export class MyComponent {
22
// ...
33
static ɵfac = function MyComponent_Factory(__ngFactoryType__) {
4-
return new (__ngFactoryType__ || MyComponent)(
5-
$r3$.ɵɵdirectiveInject($i$.ElementRef), $r3$.ɵɵdirectiveInject($i$.ViewContainerRef),
6-
$r3$.ɵɵdirectiveInject($i$.ChangeDetectorRef));
4+
/* @ts-ignore */
5+
return new (__ngFactoryType__ || MyComponent)($r3$.ɵɵdirectiveInject($i$.ElementRef), $r3$.ɵɵdirectiveInject($i$.ViewContainerRef), $r3$.ɵɵdirectiveInject($i$.ChangeDetectorRef));
76
};
87
// ...
98
}

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/ng_modules/TEST_CASES.json

Lines changed: 31 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -3,87 +3,57 @@
33
"cases": [
44
{
55
"description": "should define a basic NgModule (linked)",
6-
"inputFiles": [
7-
"basic_linked.ts"
8-
],
6+
"inputFiles": ["basic_linked.ts"],
97
"expectations": [
108
{
119
"failureMessage": "Invalid NgModule/Injector definition",
12-
"files": [
13-
"basic_linked.js"
14-
]
10+
"files": ["basic_linked.js"]
1511
}
1612
],
17-
"compilationModeFilter": [
18-
"linked compile",
19-
"declaration-only emit"
20-
]
13+
"compilationModeFilter": ["linked compile", "declaration-only emit"]
2114
},
2215
{
23-
"description": "should define a basic NgModule (full/local)",
24-
"inputFiles": [
25-
"basic_full.ts"
26-
],
16+
"description": "should define a basic NgModule (full/local)",
17+
"inputFiles": ["basic_full.ts"],
2718
"expectations": [
2819
{
2920
"failureMessage": "Invalid NgModule/Injector definition",
30-
"files": [
31-
"basic_full.js"
32-
]
21+
"files": ["basic_full.js"]
3322
}
3423
],
35-
"compilationModeFilter": [
36-
"full compile",
37-
"local compile",
38-
"declaration-only emit"
39-
]
24+
"compilationModeFilter": ["full compile", "local compile", "declaration-only emit"]
4025
},
4126
{
4227
"description": "should define an NgModule with declarations and bootstrap",
43-
"inputFiles": [
44-
"declarations.ts"
45-
],
28+
"inputFiles": ["declarations.ts"],
4629
"expectations": [
4730
{
4831
"failureMessage": "Invalid NgModule/Injector definition",
49-
"files": [
50-
"declarations.js"
51-
]
32+
"files": ["declarations.js"]
5233
}
5334
]
5435
},
5536
{
5637
"description": "should define an NgModule with declarations and bootstrap (jit mode)",
57-
"inputFiles": [
58-
"declarations_jit_mode.ts"
59-
],
38+
"inputFiles": ["declarations_jit_mode.ts"],
6039
"expectations": [
6140
{
6241
"failureMessage": "Invalid NgModule/Injector definition",
63-
"files": [
64-
"declarations_jit_mode.js"
65-
]
42+
"files": ["declarations_jit_mode.js"]
6643
}
6744
],
68-
"compilationModeFilter": [
69-
"linked compile",
70-
"declaration-only emit"
71-
],
45+
"compilationModeFilter": ["linked compile", "declaration-only emit"],
7246
"angularCompilerOptions": {
7347
"linkerJitMode": true
7448
}
7549
},
7650
{
7751
"description": "should define an NgModule and injector with providers",
78-
"inputFiles": [
79-
"providers.ts"
80-
],
52+
"inputFiles": ["providers.ts"],
8153
"expectations": [
8254
{
8355
"failureMessage": "Invalid NgModule/Injector definition",
84-
"files": [
85-
"providers.js"
86-
]
56+
"files": ["providers.js"]
8757
}
8858
],
8959
"compilationModeFilter": [
@@ -95,55 +65,36 @@
9565
},
9666
{
9767
"description": "should define NgModules with imports and exports",
98-
"inputFiles": [
99-
"imports_exports.ts"
100-
],
68+
"inputFiles": ["imports_exports.ts"],
10169
"expectations": [
10270
{
10371
"failureMessage": "Invalid NgModule/Injector definition",
104-
"files": [
105-
"imports_exports.js"
106-
]
72+
"files": ["imports_exports.js"]
10773
}
10874
],
109-
"compilationModeFilter": [
110-
"full compile",
111-
"local compile",
112-
"declaration-only emit"
113-
]
75+
"compilationModeFilter": ["full compile", "local compile", "declaration-only emit"]
11476
},
11577
{
11678
"description": "should define NgModules with imports and exports (jit mode)",
117-
"inputFiles": [
118-
"imports_exports_jit_mode.ts"
119-
],
79+
"inputFiles": ["imports_exports_jit_mode.ts"],
12080
"expectations": [
12181
{
12282
"failureMessage": "Invalid NgModule/Injector definition",
123-
"files": [
124-
"imports_exports_jit_mode.js"
125-
]
83+
"files": ["imports_exports_jit_mode.js"]
12684
}
12785
],
128-
"compilationModeFilter": [
129-
"linked compile",
130-
"declaration-only emit"
131-
],
86+
"compilationModeFilter": ["linked compile", "declaration-only emit"],
13287
"angularCompilerOptions": {
13388
"linkerJitMode": true
13489
}
13590
},
13691
{
13792
"description": "should not process NgModules that are marked `jit`",
138-
"inputFiles": [
139-
"no_aot.ts"
140-
],
93+
"inputFiles": ["no_aot.ts"],
14194
"expectations": [
14295
{
14396
"failureMessage": "Invalid NgModule/Injector definition",
144-
"files": [
145-
"no_aot.js"
146-
]
97+
"files": ["no_aot.js"]
14798
}
14899
],
149100
"compilationModeFilter": [
@@ -155,15 +106,11 @@
155106
},
156107
{
157108
"description": "should handle NgModules that extend other classes",
158-
"inputFiles": [
159-
"inheritance.ts"
160-
],
109+
"inputFiles": ["inheritance.ts"],
161110
"expectations": [
162111
{
163112
"failureMessage": "Invalid NgModule/Injector definition",
164-
"files": [
165-
"inheritance.js"
166-
]
113+
"files": ["inheritance.js"]
167114
}
168115
],
169116
"compilationModeFilter": [
@@ -175,36 +122,25 @@
175122
},
176123
{
177124
"description": "should handle NgModules with forward refs",
178-
"inputFiles": [
179-
"forward_refs.ts"
180-
],
125+
"inputFiles": ["forward_refs.ts"],
181126
"expectations": [
182127
{
183128
"failureMessage": "Invalid NgModule/Injector definition",
184-
"files": [
185-
"forward_refs.js"
186-
]
129+
"files": ["forward_refs.js"]
187130
}
188131
],
189-
"compilationModeFilter": [
190-
"linked compile",
191-
"declaration-only emit"
192-
],
132+
"compilationModeFilter": ["linked compile", "declaration-only emit"],
193133
"angularCompilerOptions": {
194134
"linkerJitMode": true
195135
}
196136
},
197137
{
198138
"description": "should not pass along empty array fields to the declaration",
199-
"inputFiles": [
200-
"empty_fields.ts"
201-
],
139+
"inputFiles": ["empty_fields.ts"],
202140
"expectations": [
203141
{
204142
"failureMessage": "Empty declaration exists",
205-
"files": [
206-
"empty_fields.js"
207-
]
143+
"files": ["empty_fields.js"]
208144
}
209145
],
210146
"compilationModeFilter": [
@@ -216,15 +152,11 @@
216152
},
217153
{
218154
"description": "should handle providers passed in as a variable",
219-
"inputFiles": [
220-
"variable_providers.ts"
221-
],
155+
"inputFiles": ["variable_providers.ts"],
222156
"expectations": [
223157
{
224158
"failureMessage": "Invalid injector definition",
225-
"files": [
226-
"variable_providers.js"
227-
]
159+
"files": ["variable_providers.js"]
228160
}
229161
],
230162
"compilationModeFilter": [

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/ng_modules/inheritance.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
export class BaseModule {
22
// ...
33
constructor(service) { this.service = service; }
4-
static ɵfac = function BaseModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BaseModule)(i0.ɵɵinject(Service)); };
4+
static ɵfac = function BaseModule_Factory(__ngFactoryType__) {
5+
/* @ts-ignore */
6+
return new (__ngFactoryType__ || BaseModule)(i0.ɵɵinject(Service));
7+
};
58
static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: BaseModule });
69
static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [Service] });
710
}

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/ng_modules/inheritance.local.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
export class BaseModule {
22
33
constructor(service) { this.service = service; }
4-
static ɵfac = function BaseModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BaseModule)(i0.ɵɵinject(Service)); };
4+
static ɵfac = function BaseModule_Factory(__ngFactoryType__) {
5+
/* @ts-ignore */
6+
return new (__ngFactoryType__ || BaseModule)(i0.ɵɵinject(Service));
7+
};
58
static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: BaseModule });
69
static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [Service] });
710
}
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
export class MyComponent {
22
// ...
33
static ɵfac = function MyComponent_Factory(__ngFactoryType__) {
4-
return new (__ngFactoryType__ || MyComponent)(
5-
$r3$.ɵɵinjectAttribute('name'),
6-
$r3$.ɵɵinjectAttribute(dynamicAttrName()),
7-
$r3$.ɵɵdirectiveInject(MyService),
8-
$r3$.ɵɵdirectiveInject(MyService, 1),
9-
$r3$.ɵɵdirectiveInject(MyService, 2),
10-
$r3$.ɵɵdirectiveInject(MyService, 4),
11-
$r3$.ɵɵdirectiveInject(MyService, 8),
12-
$r3$.ɵɵdirectiveInject(MyService, 10)
13-
);
4+
/* @ts-ignore */
5+
return new (__ngFactoryType__ || MyComponent)($r3$.ɵɵinjectAttribute('name'), $r3$.ɵɵinjectAttribute(dynamicAttrName()), $r3$.ɵɵdirectiveInject(MyService), $r3$.ɵɵdirectiveInject(MyService, 1), $r3$.ɵɵdirectiveInject(MyService, 2), $r3$.ɵɵdirectiveInject(MyService, 4), $r3$.ɵɵdirectiveInject(MyService, 8), $r3$.ɵɵdirectiveInject(MyService, 10));
146
}
157
// ...
168
}

packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_di/di/ctor_overload_fac.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export class MyService {
22
// ...
33
static ɵfac = function MyService_Factory(__ngFactoryType__) {
4+
/* @ts-ignore */
45
return new (__ngFactoryType__ || MyService)($r3$.ɵɵinject(MyDependency), $r3$.ɵɵinject(MyOptionalDependency, 8));
56
}
67
// ...

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy