Add path mapping to the root tsconfig#6957
Merged
mattsoulanille merged 4 commits intotensorflow:masterfrom Oct 26, 2022
Merged
Conversation
This change lets editors properly resolve imports across packages. Now, "go to definition" goes to the ".ts" file instead of the ".d.ts" file.
mattsoulanille
commented
Oct 19, 2022
tfjs-converter/src/operations/executors/basic_math_executor_test.ts
Outdated
Show resolved
Hide resolved
4482c86 to
a397c33
Compare
Linchenn
approved these changes
Oct 19, 2022
Collaborator
Linchenn
left a comment
There was a problem hiding this comment.
This is really helpful, thank you Matt!
Create tsconfig_base.ts which has no path mapping. This allows non-bazel packages to properly reference @tensorflow-scoped dependencies in their node_modules directories instead of looking at the source files.
pyu10055
approved these changes
Oct 25, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use TypeScript path mapping to specify paths between monorepo packages. This allows editors to correctly "go to definition" across packages, and ensures they reference the
.tsfile instead of.d.ts.This could also work for
@tensorflow/tfjs-convertergeneratedop_listfiles, but that would require changing the relative imports to absolute imports from dist, e.g.@tensorflow/tfjs-converter/dist/operations/op_list/basic_math.Before:

After:

To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.
This change is