fix(core): avoid migration error when non-existent symbol is imported#36367
fix(core): avoid migration error when non-existent symbol is imported#36367devversion wants to merge 1 commit intoangular:masterfrom
Conversation
crisbeto
left a comment
There was a problem hiding this comment.
The changes LGTM, but I'm wondering whether we couldn't move the resolve call into a common place (e.g. where the new error was added). It seems like we're repeating it in several places and we could forget to add it in any new migrations.
6573756 to
e5ce569
Compare
|
@crisbeto Agreed. I wanted to reduce the overall TS program duplication separately, but now did it in this PR. Can you please have another look? |
e5ce569 to
f838c26
Compare
|
@devversion Can you rebase? |
f838c26 to
9101561
Compare
In rare cases a project with configured `rootDirs` that has imports to non-existent identifiers could fail in the migration. This happens because based on the application code, the migration could end up trying to resolve the `ts.Symbol` of such non-existent identifiers. This isn't a problem usually, but due to a upstream bug in the TypeScript compiler, a runtime error is thrown. This is because TypeScript is unable to compute a relative path from the originating source file to the imported source file which _should_ provide the non-existent identifier. An issue for this has been reported upstream: microsoft/TypeScript#37731. The issue only surfaces since our migrations don't provide an absolute base path that is used for resolving the root directories. To fix this, we ensure that we never use relative paths when parsing tsconfig files. More details can be found in the TS issue. Fixes angular#36346.
9101561 to
d7cfc9e
Compare
|
@kara Done. Thx for reviewing! Waiting for the PR to turn green. |
|
Caretaker: Can you please run presubmit for this? Thank you! |
…#36367) In rare cases a project with configured `rootDirs` that has imports to non-existent identifiers could fail in the migration. This happens because based on the application code, the migration could end up trying to resolve the `ts.Symbol` of such non-existent identifiers. This isn't a problem usually, but due to a upstream bug in the TypeScript compiler, a runtime error is thrown. This is because TypeScript is unable to compute a relative path from the originating source file to the imported source file which _should_ provide the non-existent identifier. An issue for this has been reported upstream: microsoft/TypeScript#37731. The issue only surfaces since our migrations don't provide an absolute base path that is used for resolving the root directories. To fix this, we ensure that we never use relative paths when parsing tsconfig files. More details can be found in the TS issue. Fixes #36346. PR Close #36367
|
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. |
In rare cases a project with configured
rootDirsthat has imports tonon-existent identifiers could fail in the migration.
This happens because based on the application code, the migration could
end up trying to resolve the
ts.Symbolof such non-existentidentifiers. This isn't a problem usually, but due to a upstream bug
in the TypeScript compiler, a runtime error is thrown.
This is because TypeScript is unable to compute a relative path from the
originating source file to the imported source file which should
provide the non-existent identifier. An issue for this has been reported
upstream: microsoft/TypeScript#37731. The
issue only surfaces since our migrations don't provide an absolute base
path that is used for resolving the root directories.
To fix this, we ensure that we never use relative paths when parsing
tsconfig files. More details can be found in the TS issue.
Fixes #36346.