angular/packages/compiler-cli
tomalaforge d47fef72cb fix(common): strict type checking for ngtemplateoutlet (#48374)
When we create a context to inject inside our ngTemplateOutlet, the context was declare as Object, therefore, there are no compilation error.

Now if we add a context, we get error at compile type.

BREAKING CHANGE:  If the 'ngTemplateOutletContext' is different from the context, it will result in a compile-time error.

Before the change, the following template was compiling:

```typescript
interface MyContext {
  $implicit: string;
}

@Component({
  standalone: true,
  imports: [NgTemplateOutlet],
  selector: 'person',
  template: `
    <ng-container
      *ngTemplateOutlet="
        myTemplateRef;
        context: { $implicit: 'test', xxx: 'xxx' }
      "></ng-container>
  `,
})
export class PersonComponent {
  myTemplateRef!: TemplateRef<MyContext>;
}
```
However, it does not compile now because the 'xxx' property does not exist in 'MyContext', resulting in the error: 'Type '{ $implicit: string; xxx: string; }' is not assignable to type 'MyContext'.'

The solution is either:
- add the 'xxx' property to 'MyContext' with the correct type or
- add '$any(...)' inside the template to make the error disappear. However, adding '$any(...)' does not correct the error but only preserves the previous behavior of the code.

fix #43510

PR Close #48374
2023-03-23 11:35:07 -07:00
..
integrationtest feat(core): remove entryComponents (#49484) 2023-03-23 10:38:03 -07:00
linker feat(compiler): add support for compile-time required inputs (#49468) 2023-03-20 13:10:30 +01:00
private refactor(compiler-cli): remove unused class decorator downlevel code (#49351) 2023-03-08 17:59:12 +00:00
src fix(common): strict type checking for ngtemplateoutlet (#48374) 2023-03-23 11:35:07 -07:00
test feat(compiler): add support for compile-time required inputs (#49468) 2023-03-20 13:10:30 +01:00
BUILD.bazel refactor: remove Angular Compatibility Compiler (ngcc) (#49101) 2023-02-16 16:01:17 -08:00
esbuild.config.js refactor: remove __ESM_IMPORT_META_URL__ workaround now that we can use ESM (#48521) 2022-12-19 19:50:41 +00:00
index.ts refactor(compiler-cli): Export the interface PluginCompilerHost for 1p use. (#48874) 2023-02-02 09:44:18 -08:00
package.json refactor(core): remove Node.js v14 support (#49255) 2023-02-28 11:00:25 -08:00
tsconfig-build.json refactor(compiler-cli): dismantle View Engine implementation of ngc (#44269) 2021-12-01 10:36:30 -08:00
tsconfig.json build: update tsconfigs to use ES2020 as target and module (#43431) 2021-10-01 18:28:42 +00:00