Compiler CLI typings cannot be processed with typescript 4.2.4
See original GitHub issueBug Report
Affected Package
The issue is caused by package @angular/compiler-cli
Is this a regression?
Don’t know
Description
Compiler CLI uses ts.MemberName type, which in typescript 4.2.4 is not present, probable added in typescript 4.3 which reports error:
node_modules/@angular/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.d.ts:38:73 - error TS2694: Namespace 'ts' has no exported member 'MemberName'.
Minimal Reproduction
Try to compile compiler-cli ts files with ts 4.2.4Exception or Error
node_modules/@angular/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.d.ts:38:73 - error TS2694: Namespace 'ts' has no exported member 'MemberName'.
Your Environment
Angular Version:
Angular CLI: 12.1.0
Anything else relevant? Probably compiler-cli should require at last typescript 4.3 or should not use types which were not present in typescript 4.2.4
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Versions of @angular/compiler-cli and typescript could not be ...
This may be a problem in not implicitly running devDependencies. Try running them implicitly with the command below. npm install --dev.
Read more >Documentation - TypeScript 4.2
TypeScript has a way to declare new names for types called type aliases. If you're writing a set of functions that all work...
Read more >@angular/compiler-cli | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >Angular 12 in Depth - Sébastien Dubois
Previously, work from prior compilation could not be reused when TypeScript deduplicated source files. You can read more about that here. The ...
Read more >TypeScript Quickly [1 ed.] 1617295949, 9781617295942
4.2.4 Enforcing the return type of higher-order functions ... Configuring the TypeScript compilation 228 What's in package.json 230 Configuring nodemon 232 ...
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
@ngtools/webpack
supports the exact versions of TypeScript versions that the framework support, in terms of which version of TypeScript can be used to compile an application.Therefore, changing the TypeScript peer dependency to the upper bound version would not be correct here and technically it would be a breaking change.
We can add it to the docs, although from my experience this is the first time that someone experienced this problem and seeing that this issue didn’t receive any community interest. I’d say it doesn’t warrant to do any change from our end and having this issue on GitHub should be sufficient.
We can always revisit this if we see that it impacts the community in a greater manner, but for the time being my suggestion would be to close this issue as also by using
@ngtools/webpack
directly you are opting to off the “happy path”.Discussed this with @devversion and we feel that the best course of action here is that if you are using the compiler-cli types/API both directly or transitively via
@ngtools/webpack
. The better option would be to use the same TypeScript version used to compile the package. This is typically the max version which is supported by the Angular Compiler. If for a reason or another this is not possible usingskipLibCheck
as an interim solution is a good enough workaround.The reasoning behind this is that while making
@angular/compiler-cli
work with TypeScript 4.2 type-wise is straightforward in this case, it sets the precedent for us “caring” about such things which might complicate things in the future.While we do guarantee the the compiler will compile source files when using TypeScript 4.2, we don’t guarantee that its’ types are compatible with this version.