-
Notifications
You must be signed in to change notification settings - Fork 12k
noImplicitAny from parent tsconfig.json cannot be overridden in projects (libraries) #25980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @digeomel, I am unable to replicate the issue with the reproduction provided.
|
@alan-agius4 I have forgotten to add the Test1Module and Test2Module to main AppModule. Of course I'm building those libraries to use them in the main app. Please pull the latest and try again with just ~ ng build
✔ Browser application bundle generation complete.
Error: projects/test2/src/lib/test2.component.ts:14:25 - error TS7006: Parameter 'param' implicitly has an 'any' type.
14 testMethodWithParam(param) {
~~~~~ |
@alan-agius4 also, if you open the |
This is expected as vscode TypeScript language service can only read tsconfig files that are named As a workaround you can rename |
@alan-agius4 will this also fix the build? |
The problem with the build is that the libraries are being imported incorrectly. - import { Test1Module } from 'projects/test1/src/public-api';
+ import { Test1Module } from 'test1';
- import { Test2Module } from 'projects/test2/src/public-api';
+ import { Test2Module } from 'test2'; |
This will only work if the libraries are first built independently and then I build the main app, i.e. |
Currently there is no way to build multiple projects with a single command. Please see: #11002 Closing as this is working as expected since the library is being build as part of the application. IE: you don't have a 2 libraries and an application but just an application. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Command
build
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I have an Angular 15 workspace with a main app and multiple independent projects (aka libraries). For the main app and some projects, I want to set
noImplicitAny: true
for the TypeScript compiler, but for some others, I want it to remainfalse
(the default). Thetsconfig.lib.json
files inside the libraries are extending the maintsconfig.json
from the root Angular folder (although I tried removing theextends
as well, no difference, read below).The problem is, no matter what I do, I keep getting errors about
noImplicitAny
from the libraries where it is even explicitly set to false! It seems that the TypeScript compiler disregards the individualtsconfig.lib.json
settings inside those libraries and takes the global setting.Moreover, I tried moving the setting from the main
tsconfig.json
in the root folder, to the app-specificsrc/tsconfig.app.json
and I still get the same error from the libraries!These are the other contents of the main
tsconfig.json
file:We are not using "full" TypeScript strict mode.
What am I missing?
Minimal Reproduction
This is a repo which reproduces the problem:
https://github.com/digeomel/angular-no-implicit-any
Exception or Error
Your Environment
Anything else relevant?
I posted this issue first on the Typescript repo and I got the answer that this is the expected behaviour, but I thought that maybe the Angular compiler spawns individual, separate processes to compile each project, respecting the tsconfig file in each.
In any case, this seems counter-intuitive to me. If there's a workaround, I'd like to know it.
Here's the issue on the Typescript repo:
microsoft/TypeScript#55983
The text was updated successfully, but these errors were encountered: