-
Notifications
You must be signed in to change notification settings - Fork 25k
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
fix(compiler-cli): readConfiguration
existing options should override options in tsconfig
#40694
fix(compiler-cli): readConfiguration
existing options should override options in tsconfig
#40694
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, I hate how convoluted this whole area of code is.
I appreciate that this is not the fault of this PR.
But I wonder if we ought to take this opportunity to clean it up rather than patching it after the fact, which is basically what we are doing in this PR.
As I understand it there are "TypeScript" configurations and "Angular" configurations.
We have to effectively parse the tsconfig.json
twice with two different tools to extract each.
On top of this the caller can pass in an object of programmatically defined existingOptions
which should override those that appear in the tsconfig.json
. But since this existingOptions
(despite the typing) can contain Angular options too, we have to do this overriding twice.
So I think that the config
object should only contain Angular options and the parsed.options
should only contain TypeScript options.
I believe that the call to ts.parseJsonConfigFileContent()
should already override the TypeScript options with those from existingOptions
but I think that this will not apply the Angular parts of existingOptions
over the top of those in config
.
So I think that the right thing to do is to fix the config
object so that it has the Angular options overridden by those in existingOptions
before passing it to createNgCompilerOptions()
, which should not have to care about overriding.
Does that sound right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - just a couple of suggested refactorings.
@petebacondarwin updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Reviewed-For: bazel
…de options in tsconfig At the moment, when passing an Angular Compiler option in the `existingOptions` it doesn't override the defined in the TSConfig.
With this change we clean up the parsing of tsconfig files.
TypeScript supports non rooted extends, we should do the same https://github.com/microsoft/TypeScript/blob/b346f5764e4d500ebdeff7086e43690ea533a305/src/compiler/commandLineParser.ts#L2603-L2628 Closes: #36715
I can re-add that method although I prefer not to, but if it’s widely used in G3 I will be easier. |
@alan-agius4 FYI I've started a new presubmit (+ TGP) after @kyliau submitted an internal refactoring to avoid using |
@alan-agius4 FYI presubmits were successful for the changes in this PR, adding the "merge" label back. Thank you. |
thanks @AndrewKushnir ! |
Thanks @AndrewKushnir & @kyliau for your help. |
With this change we clean up the parsing of tsconfig files. PR Close #40694
…ode (#40694) TypeScript supports non rooted extends, we should do the same https://github.com/microsoft/TypeScript/blob/b346f5764e4d500ebdeff7086e43690ea533a305/src/compiler/commandLineParser.ts#L2603-L2628 Closes: #36715 PR Close #40694
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. |
fix(compiler-cli): extend
angularCompilerOptions
in tsconfig from nodeTypeScript supports non rooted extends, we should do the same
https://github.com/microsoft/TypeScript/blob/b346f5764e4d500ebdeff7086e43690ea533a305/src/compiler/commandLineParser.ts#L2603-L2628
Closes: #36715
refactor(bazel): use
readConfiguration
to read config fileWith this change we clean up the parsing of tsconfig files.
fix(compiler-cli):
readConfiguration
existing options should override options in tsconfigAt the moment, when passing an Angular Compiler option
in the
existingOptions
it doesn't override the defined in the TSConfig.