Skip to content

Commit 1d4a41f

Browse files
committed
fix(compiler): report unknown property bindings on explicit ng-template elements
Previously, property bindings on `<ng-template>` that were not claimed by a matched directive were silently ignored by the type checker. This was inconsistent with how bindings on regular elements are handled. Fixes angular#69322
1 parent a5f1b20 commit 1d4a41f

14 files changed

Lines changed: 286 additions & 32 deletions

File tree

packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_template/GOLDEN_PARTIAL.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export declare class MyModule {
321321
/****************************************************************************************************
322322
* PARTIAL FILE: ng_template.js
323323
****************************************************************************************************/
324-
import { Component, NgModule } from '@angular/core';
324+
import { Component, NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
325325
import * as i0 from "@angular/core";
326326
export class MyComponent {
327327
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: MyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
@@ -348,14 +348,15 @@ export class MyModule {
348348
}
349349
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: MyModule, decorators: [{
350350
type: NgModule,
351-
args: [{ declarations: [MyComponent] }]
351+
args: [{ declarations: [MyComponent], schemas: [NO_ERRORS_SCHEMA] }]
352352
}] });
353353

354354
/****************************************************************************************************
355355
* PARTIAL FILE: ng_template.d.ts
356356
****************************************************************************************************/
357357
import * as i0 from "@angular/core";
358358
export declare class MyComponent {
359+
b: any;
359360
static ɵfac: i0.ɵɵFactoryDeclaration<MyComponent, never>;
360361
static ɵcmp: i0.ɵɵComponentDeclaration<MyComponent, "my-component", never, {}, {}, never, never, false, never>;
361362
}
@@ -971,7 +972,7 @@ export declare class MyModule {
971972
/****************************************************************************************************
972973
* PARTIAL FILE: ng_template_bindings.js
973974
****************************************************************************************************/
974-
import { Component } from '@angular/core';
975+
import { Component, NO_ERRORS_SCHEMA } from '@angular/core';
975976
import * as i0 from "@angular/core";
976977
export class MyComponent {
977978
p1;
@@ -985,6 +986,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDE
985986
args: [{
986987
selector: 'my-component',
987988
template: '<ng-template l="l1" [p]="p1" [attr.a]="a1" [class.c]="c1"></ng-template>',
989+
schemas: [NO_ERRORS_SCHEMA],
988990
}]
989991
}] });
990992

@@ -1309,7 +1311,7 @@ export declare class MyModule {
13091311
/****************************************************************************************************
13101312
* PARTIAL FILE: ng_template_implicit.js
13111313
****************************************************************************************************/
1312-
import { Component } from '@angular/core';
1314+
import { Component, NO_ERRORS_SCHEMA } from '@angular/core';
13131315
import * as i0 from "@angular/core";
13141316
export class MyComponent {
13151317
p1;
@@ -1323,6 +1325,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDE
13231325
args: [{
13241326
selector: 'my-component',
13251327
template: '<ng-template let-a [ngIf]="true">{{a}}</ng-template>',
1328+
schemas: [NO_ERRORS_SCHEMA],
13261329
}]
13271330
}] });
13281331

packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_template/ng_template.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, NgModule} from '@angular/core';
1+
import {Component, NgModule, NO_ERRORS_SCHEMA} from '@angular/core';
22

33
@Component({
44
selector: 'my-component',
@@ -9,8 +9,9 @@ import {Component, NgModule} from '@angular/core';
99
standalone: false
1010
})
1111
export class MyComponent {
12+
declare b: any;
1213
}
1314

14-
@NgModule({declarations: [MyComponent]})
15+
@NgModule({declarations: [MyComponent], schemas: [NO_ERRORS_SCHEMA]})
1516
export class MyModule {
1617
}

packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_template/ng_template_bindings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import {Component} from '@angular/core';
1+
import {Component, NO_ERRORS_SCHEMA} from '@angular/core';
22

33
@Component({
44
selector: 'my-component',
55
template: '<ng-template l="l1" [p]="p1" [attr.a]="a1" [class.c]="c1"></ng-template>',
6+
schemas: [NO_ERRORS_SCHEMA],
67
})
78
export class MyComponent {
89
p1!: any;

packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_template/ng_template_implicit.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import {Component} from '@angular/core';
1+
import {Component, NO_ERRORS_SCHEMA} from '@angular/core';
22

33
@Component({
44
selector: 'my-component',
55
template: '<ng-template let-a [ngIf]="true">{{a}}</ng-template>',
6+
schemas: [NO_ERRORS_SCHEMA],
67
})
78
export class MyComponent {
89
p1!: any;

packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_template/ng_template_isolated.golden.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as i0 from "@angular/core";
22
export declare class MyComponent {
3+
b: any;
34
static ɵfac: i0.ɵɵFactoryDeclaration<MyComponent, never>;
45
static ɵcmp: i0.ɵɵComponentDeclaration<MyComponent, "my-component", never, {}, {}, never, never, false, never>;
56
}

packages/compiler-cli/test/compliance/test_cases/source_mapping/inline_templates/GOLDEN_PARTIAL.js

Lines changed: 68 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ export declare class TestCmp {
12651265
/****************************************************************************************************
12661266
* PARTIAL FILE: ng_if_templated.js
12671267
****************************************************************************************************/
1268-
import { Component } from '@angular/core';
1268+
import { Component, NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
12691269
import * as i0 from "@angular/core";
12701270
export class TestCmp {
12711271
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmp, deps: [], target: i0.ɵɵFactoryTarget.Component });
@@ -1287,24 +1287,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDE
12871287
standalone: false
12881288
}]
12891289
}] });
1290+
export class TestCmpModule {
1291+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1292+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule, declarations: [TestCmp] });
1293+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule });
1294+
}
1295+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule, decorators: [{
1296+
type: NgModule,
1297+
args: [{ declarations: [TestCmp], schemas: [NO_ERRORS_SCHEMA] }]
1298+
}] });
12901299
//# sourceMappingURL=ng_if_templated.js.map
12911300
/****************************************************************************************************
12921301
* PARTIAL FILE: ng_if_templated.js.map
12931302
****************************************************************************************************/
1294-
{"version":3,"file":"ng_if_templated.js","sourceRoot":"","sources":["../ng_if_templated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;;AAWxC,MAAM,OAAO,OAAO;kHAAP,OAAO;sGAAP,OAAO,qEAPN;;;;mBAIK;;sGAGN,OAAO;kBATnB,SAAS;mBAAC;oBACP,QAAQ,EAAE,UAAU;oBACpB,QAAQ,EAAE;;;;mBAIK;oBACf,UAAU,EAAE,KAAK;iBACpB"}
1303+
{"version":3,"file":"ng_if_templated.js","sourceRoot":"","sources":["../ng_if_templated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;;AAWpE,MAAM,OAAO,OAAO;kHAAP,OAAO;sGAAP,OAAO,qEAPN;;;;mBAIK;;sGAGN,OAAO;kBATnB,SAAS;mBAAC;oBACP,QAAQ,EAAE,UAAU;oBACpB,QAAQ,EAAE;;;;mBAIK;oBACf,UAAU,EAAE,KAAK;iBACpB;;AAMD,MAAM,OAAO,aAAa;kHAAb,aAAa;mHAAb,aAAa,iBALb,OAAO;mHAKP,aAAa;;sGAAb,aAAa;kBADzB,QAAQ;mBAAC,EAAC,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,gBAAgB,CAAC,EAAC"}
12951304
/****************************************************************************************************
12961305
* PARTIAL FILE: ng_if_templated.d.ts
12971306
****************************************************************************************************/
12981307
import * as i0 from "@angular/core";
12991308
export declare class TestCmp {
1309+
showMessage: () => boolean;
13001310
static ɵfac: i0.ɵɵFactoryDeclaration<TestCmp, never>;
13011311
static ɵcmp: i0.ɵɵComponentDeclaration<TestCmp, "test-cmp", never, {}, {}, never, never, false, never>;
13021312
}
1313+
export declare class TestCmpModule {
1314+
static ɵfac: i0.ɵɵFactoryDeclaration<TestCmpModule, never>;
1315+
static ɵmod: i0.ɵɵNgModuleDeclaration<TestCmpModule, [typeof TestCmp], never, never>;
1316+
static ɵinj: i0.ɵɵInjectorDeclaration<TestCmpModule>;
1317+
}
13031318

13041319
/****************************************************************************************************
13051320
* PARTIAL FILE: ng_if_templated.js
13061321
****************************************************************************************************/
1307-
import { Component } from '@angular/core';
1322+
import { Component, NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
13081323
import * as i0 from "@angular/core";
13091324
export class TestCmp {
13101325
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmp, deps: [], target: i0.ɵɵFactoryTarget.Component });
@@ -1326,19 +1341,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDE
13261341
standalone: false
13271342
}]
13281343
}] });
1344+
export class TestCmpModule {
1345+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1346+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule, declarations: [TestCmp] });
1347+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule });
1348+
}
1349+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule, decorators: [{
1350+
type: NgModule,
1351+
args: [{ declarations: [TestCmp], schemas: [NO_ERRORS_SCHEMA] }]
1352+
}] });
13291353
//# sourceMappingURL=ng_if_templated.js.map
13301354
/****************************************************************************************************
13311355
* PARTIAL FILE: ng_if_templated.js.map
13321356
****************************************************************************************************/
1333-
{"version":3,"file":"ng_if_templated.js","sourceRoot":"","sources":["../ng_if_templated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;;AAWxC,MAAM,OAAO,OAAO;kHAAP,OAAO;sGAAP,OAAO,qEAPN;;;;mBAIK;;sGAGN,OAAO;kBATnB,SAAS;mBAAC;oBACP,QAAQ,EAAE,UAAU;oBACpB,QAAQ,EAAE;;;;mBAIK;oBACf,UAAU,EAAE,KAAK;iBACpB"}
1357+
{"version":3,"file":"ng_if_templated.js","sourceRoot":"","sources":["../ng_if_templated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;;AAWpE,MAAM,OAAO,OAAO;kHAAP,OAAO;sGAAP,OAAO,qEAPN;;;;mBAIK;;sGAGN,OAAO;kBATnB,SAAS;mBAAC;oBACP,QAAQ,EAAE,UAAU;oBACpB,QAAQ,EAAE;;;;mBAIK;oBACf,UAAU,EAAE,KAAK;iBACpB;;AAMD,MAAM,OAAO,aAAa;kHAAb,aAAa;mHAAb,aAAa,iBALb,OAAO;mHAKP,aAAa;;sGAAb,aAAa;kBADzB,QAAQ;mBAAC,EAAC,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,gBAAgB,CAAC,EAAC"}
13341358
/****************************************************************************************************
13351359
* PARTIAL FILE: ng_if_templated.d.ts
13361360
****************************************************************************************************/
13371361
import * as i0 from "@angular/core";
13381362
export declare class TestCmp {
1363+
showMessage: () => boolean;
13391364
static ɵfac: i0.ɵɵFactoryDeclaration<TestCmp, never>;
13401365
static ɵcmp: i0.ɵɵComponentDeclaration<TestCmp, "test-cmp", never, {}, {}, never, never, false, never>;
13411366
}
1367+
export declare class TestCmpModule {
1368+
static ɵfac: i0.ɵɵFactoryDeclaration<TestCmpModule, never>;
1369+
static ɵmod: i0.ɵɵNgModuleDeclaration<TestCmpModule, [typeof TestCmp], never, never>;
1370+
static ɵinj: i0.ɵɵInjectorDeclaration<TestCmpModule>;
1371+
}
13421372

13431373
/****************************************************************************************************
13441374
* PARTIAL FILE: ng_for_simple.js
@@ -1405,7 +1435,7 @@ export declare class TestCmp {
14051435
/****************************************************************************************************
14061436
* PARTIAL FILE: ng_for_templated.js
14071437
****************************************************************************************************/
1408-
import { Component } from '@angular/core';
1438+
import { Component, NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
14091439
import * as i0 from "@angular/core";
14101440
export class TestCmp {
14111441
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmp, deps: [], target: i0.ɵɵFactoryTarget.Component });
@@ -1419,24 +1449,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDE
14191449
standalone: false
14201450
}]
14211451
}] });
1452+
export class TestCmpModule {
1453+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1454+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule, declarations: [TestCmp] });
1455+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule });
1456+
}
1457+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule, decorators: [{
1458+
type: NgModule,
1459+
args: [{ declarations: [TestCmp], schemas: [NO_ERRORS_SCHEMA] }]
1460+
}] });
14221461
//# sourceMappingURL=ng_for_templated.js.map
14231462
/****************************************************************************************************
14241463
* PARTIAL FILE: ng_for_templated.js.map
14251464
****************************************************************************************************/
1426-
{"version":3,"file":"ng_for_templated.js","sourceRoot":"","sources":["../ng_for_templated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;;AAOxC,MAAM,OAAO,OAAO;kHAAP,OAAO;sGAAP,OAAO,qEAHN,wEAAwE;;sGAGzE,OAAO;kBALnB,SAAS;mBAAC;oBACP,QAAQ,EAAE,UAAU;oBACpB,QAAQ,EAAE,wEAAwE;oBAClF,UAAU,EAAE,KAAK;iBACpB"}
1465+
{"version":3,"file":"ng_for_templated.js","sourceRoot":"","sources":["../ng_for_templated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;;AAOpE,MAAM,OAAO,OAAO;kHAAP,OAAO;sGAAP,OAAO,qEAHN,wEAAwE;;sGAGzE,OAAO;kBALnB,SAAS;mBAAC;oBACP,QAAQ,EAAE,UAAU;oBACpB,QAAQ,EAAE,wEAAwE;oBAClF,UAAU,EAAE,KAAK;iBACpB;;AAMD,MAAM,OAAO,aAAa;kHAAb,aAAa;mHAAb,aAAa,iBALb,OAAO;mHAKP,aAAa;;sGAAb,aAAa;kBADzB,QAAQ;mBAAC,EAAC,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,gBAAgB,CAAC,EAAC"}
14271466
/****************************************************************************************************
14281467
* PARTIAL FILE: ng_for_templated.d.ts
14291468
****************************************************************************************************/
14301469
import * as i0 from "@angular/core";
14311470
export declare class TestCmp {
1471+
items: any[];
14321472
static ɵfac: i0.ɵɵFactoryDeclaration<TestCmp, never>;
14331473
static ɵcmp: i0.ɵɵComponentDeclaration<TestCmp, "test-cmp", never, {}, {}, never, never, false, never>;
14341474
}
1475+
export declare class TestCmpModule {
1476+
static ɵfac: i0.ɵɵFactoryDeclaration<TestCmpModule, never>;
1477+
static ɵmod: i0.ɵɵNgModuleDeclaration<TestCmpModule, [typeof TestCmp], never, never>;
1478+
static ɵinj: i0.ɵɵInjectorDeclaration<TestCmpModule>;
1479+
}
14351480

14361481
/****************************************************************************************************
14371482
* PARTIAL FILE: ng_for_templated.js
14381483
****************************************************************************************************/
1439-
import { Component } from '@angular/core';
1484+
import { Component, NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
14401485
import * as i0 from "@angular/core";
14411486
export class TestCmp {
14421487
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmp, deps: [], target: i0.ɵɵFactoryTarget.Component });
@@ -1450,19 +1495,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDE
14501495
standalone: false
14511496
}]
14521497
}] });
1498+
export class TestCmpModule {
1499+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1500+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule, declarations: [TestCmp] });
1501+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule });
1502+
}
1503+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpModule, decorators: [{
1504+
type: NgModule,
1505+
args: [{ declarations: [TestCmp], schemas: [NO_ERRORS_SCHEMA] }]
1506+
}] });
14531507
//# sourceMappingURL=ng_for_templated.js.map
14541508
/****************************************************************************************************
14551509
* PARTIAL FILE: ng_for_templated.js.map
14561510
****************************************************************************************************/
1457-
{"version":3,"file":"ng_for_templated.js","sourceRoot":"","sources":["../ng_for_templated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;;AAOxC,MAAM,OAAO,OAAO;kHAAP,OAAO;sGAAP,OAAO,qEAHN,wEAAwE;;sGAGzE,OAAO;kBALnB,SAAS;mBAAC;oBACP,QAAQ,EAAE,UAAU;oBACpB,QAAQ,EAAE,wEAAwE;oBAClF,UAAU,EAAE,KAAK;iBACpB"}
1511+
{"version":3,"file":"ng_for_templated.js","sourceRoot":"","sources":["../ng_for_templated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;;AAOpE,MAAM,OAAO,OAAO;kHAAP,OAAO;sGAAP,OAAO,qEAHN,wEAAwE;;sGAGzE,OAAO;kBALnB,SAAS;mBAAC;oBACP,QAAQ,EAAE,UAAU;oBACpB,QAAQ,EAAE,wEAAwE;oBAClF,UAAU,EAAE,KAAK;iBACpB;;AAMD,MAAM,OAAO,aAAa;kHAAb,aAAa;mHAAb,aAAa,iBALb,OAAO;mHAKP,aAAa;;sGAAb,aAAa;kBADzB,QAAQ;mBAAC,EAAC,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,gBAAgB,CAAC,EAAC"}
14581512
/****************************************************************************************************
14591513
* PARTIAL FILE: ng_for_templated.d.ts
14601514
****************************************************************************************************/
14611515
import * as i0 from "@angular/core";
14621516
export declare class TestCmp {
1517+
items: any[];
14631518
static ɵfac: i0.ɵɵFactoryDeclaration<TestCmp, never>;
14641519
static ɵcmp: i0.ɵɵComponentDeclaration<TestCmp, "test-cmp", never, {}, {}, never, never, false, never>;
14651520
}
1521+
export declare class TestCmpModule {
1522+
static ɵfac: i0.ɵɵFactoryDeclaration<TestCmpModule, never>;
1523+
static ɵmod: i0.ɵɵNgModuleDeclaration<TestCmpModule, [typeof TestCmp], never, never>;
1524+
static ɵinj: i0.ɵɵInjectorDeclaration<TestCmpModule>;
1525+
}
14661526

14671527
/****************************************************************************************************
14681528
* PARTIAL FILE: projection.js
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
import {Component} from '@angular/core';
1+
import {Component, NgModule, NO_ERRORS_SCHEMA} from '@angular/core';
22

33
@Component({
44
selector: 'test-cmp',
55
template: `<ng-template ngFor [ngForOf]="items" let-item>{{ item }}</ng-template>`,
66
standalone: false
77
})
88
export class TestCmp {
9+
declare items: any[];
10+
}
11+
12+
@NgModule({declarations: [TestCmp], schemas: [NO_ERRORS_SCHEMA]})
13+
export class TestCmpModule {
914
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import * as i0 from "@angular/core";
22
export declare class TestCmp {
3+
items: any[];
34
static ɵfac: i0.ɵɵFactoryDeclaration<TestCmp, never>;
45
static ɵcmp: i0.ɵɵComponentDeclaration<TestCmp, "test-cmp", never, {}, {}, never, never, false, never>;
56
}
7+
export declare class TestCmpModule {
8+
static ɵfac: i0.ɵɵFactoryDeclaration<TestCmpModule, never>;
9+
static ɵmod: i0.ɵɵNgModuleDeclaration<TestCmpModule, never, never, never>;
10+
static ɵinj: i0.ɵɵInjectorDeclaration<TestCmpModule>;
11+
}
612

packages/compiler-cli/test/compliance/test_cases/source_mapping/inline_templates/ng_if_templated.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component} from '@angular/core';
1+
import {Component, NgModule, NO_ERRORS_SCHEMA} from '@angular/core';
22

33
@Component({
44
selector: 'test-cmp',
@@ -10,4 +10,9 @@ import {Component} from '@angular/core';
1010
standalone: false
1111
})
1212
export class TestCmp {
13+
declare showMessage: () => boolean;
14+
}
15+
16+
@NgModule({declarations: [TestCmp], schemas: [NO_ERRORS_SCHEMA]})
17+
export class TestCmpModule {
1318
}

0 commit comments

Comments
 (0)