Compiler doesn't compile when using exactOptionalPropertyTypes
See original GitHub issueWhich @angular/* package(s) are the source of the bug?
compiler
Is this a regression?
No
Description
When bootstrapping a new project and setting "exactOptionalPropertyTypes": true
in the TypeScript configuration, the project will not compile.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Error: node_modules/@angular/compiler/src/render3/view/template.d.ts:229:22 - error TS2420: Class 'BindingScope' incorrectly implements interface 'LocalResolver'.
Types of property 'globals' are incompatible.
Type 'Set<string> | undefined' is not assignable to type 'Set<string>'.
Type 'undefined' is not assignable to type 'Set<string>'.
229 export declare class BindingScope implements LocalResolver {
~~~~~~~~~~~~
Please provide the environment you discovered this bug in
Angular CLI: 13.0.1
Node: 16.11.0
Package Manager: npm 7.21.0
OS: linux x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1300.1 (cli-only)
@angular-devkit/core 13.0.1 (cli-only)
@angular-devkit/schematics 13.0.1 (cli-only)
@schematics/angular 13.0.1 (cli-only)
Anything else?
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:9 (8 by maintainers)
Top Results From Across the Web
Improving code quality in Typescript with compiler options
This article is part 2 of Improving Typescript code quality with compiler options. Here we will cover more options in the tsconfig.json file ......
Read more >Type with optional properties that cannot be explicitly undefined
However, TypeScript 4.4 introduced the --exactOptionalPropertyTypes compiler option which, when enabled, will not let you write undefined to ...
Read more >TSConfig Reference - Docs on every TSConfig option
With exactOptionalPropertyTypes enabled, TypeScript applies stricter rules around how it handles properties on type or interfaces which have a ? prefix.
Read more >Support TypeScript tsconfig flag `exactOptionalPropertyTypes
json:compilerOptions.exactOptionalPropertyTypes set to true is not compatible with the exported types in .d.ts files from @babylonjs/core .
Read more >Angular compilation restrictions overview
Recommendation: We encourage you to use this flag as soon as you start using Typescript 4.4+. Additional TS restrictions not included in strict ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Actually re-opening because it will still be a problem until we release a new version of Angular built with 4.5.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.