Skip to content

feat(@angular/cli): use separate tsconfigs #4924

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

Merged
merged 3 commits into from
Feb 22, 2017

Conversation

filipesilva
Copy link
Contributor

@filipesilva filipesilva commented Feb 22, 2017

This PR adds tsconfigs for each separate application:

  • src/tsconfig.app.json: configuration for the Angular app.
  • src/tsconfig.spec.json: configuration for the unit tests. Defaults to the Angular app config.
  • e2e/tsconfig.e2e.json: configuration for the e2e tests.

There is an additional root-level tsconfig.json that is used for editor integration.

For new Angular version 4 projects, these tsconfigs will use inheritance since it's available with TypeScript 2.1.

This is not a breaking change. Existing projects should not be affected.

@filipesilva filipesilva changed the title Tsconfig fiesta feat(@angular/cli): use separate tsconfigs Feb 22, 2017
@filipesilva filipesilva force-pushed the tsconfig-fiesta branch 7 times, most recently from cde4917 to 6ddbcb5 Compare February 22, 2017 17:53
This PR adds tsconfigs for each separate application:
- `src/tsconfig.app.json`: configuration for the Angular app.
- `src/tsconfig.spec.json`: configuration for the unit tests. Defaults to the Angular app config.
- `e2e/tsconfig.e2e.json`: configuration for the e2e tests.

There is an additional root-level `tsconfig.json` that is used for editor integration.

For Angular version 4 projects, these tsconfigs will use inheritance since it's available with TypeScript 2.1.

This is not a breaking change. Existing projects should not be affected.
@deebloo
Copy link
Contributor

deebloo commented Feb 22, 2017

fiesta! 💃

@filipesilva
Copy link
Contributor Author

Olé! 💃

@hansl
Copy link
Contributor

hansl commented Feb 22, 2017

LGTM 💃

@filipesilva filipesilva merged commit 69e6c71 into angular:master Feb 22, 2017
@filipesilva filipesilva deleted the tsconfig-fiesta branch February 22, 2017 19:32
"target": "es5",
"module": "es2015",
"baseUrl": "",
"types": []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filipesilva A bit late question but why declaring types manually is better than having one global typeRoots (as there was before)?

"typeRoots": [
    "../node_modules/@types"
]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of reasons:

  • Some typings might actually have duplicate indentifiers. This has happened before with protractor and jquery both using $.
  • You might be using typings that really don't shouldn't in your app, like describe that should only be in unit tests, or node typings.

That being said, it is more convenient to use typeRoots if you're not too concerned with those things.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds convincing! Thanks for such a detail comment!! 🍺 🍺

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was hard to dig out, but thanks for clarifying. 👍

@jtsom
Copy link
Contributor

jtsom commented Feb 28, 2017

Just want to leave a comment about my issue - the statement above that "existing projects should not be affected" isn't entirely true...

@filipesilva
Copy link
Contributor Author

@jtsom that was a mistake on our part. It's being fixed in #5060

@jtsom
Copy link
Contributor

jtsom commented Feb 28, 2017

Ah. Cool. Also running into an issue where building/ng serve-ing the app is showing an error that it can't find a type (Auth0UserProfile in this case), but it's defined in the @types/auth0-js library, and VS code sees it fine. The code runs fine, but not sure why the build is squawking...

@filipesilva
Copy link
Contributor Author

That's likely because you have to add it to the types array in src/tsconfig.app.json. We updated https://github.com/angular/angular-cli/wiki/stories-third-party-lib to also mention that.

@jtsom
Copy link
Contributor

jtsom commented Feb 28, 2017

Was just about to make a comment about that too... would be nice if there was a mention in the rc.0 update docs to watch out for third party libs... Thanks

@filipesilva
Copy link
Contributor Author

@jtsom adding in #5147.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants