Angular and Typescript support is not compatible with inheritence

We are using a corporate template for Angular (Just) that globalize @angular dependencies and tsconfig.json.

- Problem with package.json : there is  one dependency to a common package in place of all @angular dependencies and versions (the common dependency is intalled in node_module). If I just add the @angular/common dependency, I retreive the Angular support but I don't want to.

"dependencies": {
"@corporate/common-dependencies": "x.x.x"
},

Done not works but the following code works : 

"dependencies": {
"@angular/common": "x.x.x",
"@corporate/common": "x.x.x"
},

 - Problem with tsconfig.json : my src/tsconfig.app.json use a parent in node_module in place of the standard root tsconfig.json file. If I add this standard root file, I retreive all the Typescript features but I don't want to.

{
"extends": "../node_module/@corporate/common/tsconfig.json",
"compilerOptions": {
...
0
3 comments

1. do you have @angular installed as a dependency for your '@corporate/common-dependencies' module? WebStorm only indexes direct dependencies explicitly listed in package.json, all indirect dependencies are excluded for better performance. That's why Angular modules are not available to it. You need to unexclude the corresponding folders ("Mark Directory As | Not Excluded")

2. TypeScript service we use for TypeScript support doesn't treat 'tsconfig.app.json', etc. files as configuration files, it requires them to be called 'tsconfig.json'. Renaming 'tsconfig.app.json' to 'tsconfig.json' should solve the problem

0
Avatar
Permanently deleted user

Thanks for answer.

This two workarounds work fine for now but I think the first point is an issue: or I have to make this workaround on all my projects on each npm clean, or I have to include @angular module to my corporate module, what I don't want to.

Regards

0

sorry, but we don't plan to auto-scan all indirect node dependencies to be able to provide Angular support for exotic configuration like yours. So you have to either change your configuration or apply a workaround to each of your projects

0

Please sign in to leave a comment.