-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Composite projects: support strict dependencies #36743
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
Comments
Possibly dumb question, isn't this just |
I'm not sure how rootDir would help here. In project C I want TypeScript to allow the import from B but not from A. I tried adding |
I wanted to do something similar, and I also ran into this issue with project references in our Ninja-TypeScript integration for Chromium. My attempt was to use
import * as Platform '../platform/platform.js';
export const foo = 42; If you then have your
Note that the declaration file does exist in This seems very similar to the issue described in #27572 |
We have several external contributors for Chrome DevTools and this error message is among the top of confusing error messages for our contributors. By missing a single This feature is also available in other ecosystems such as Java in Bazel: https://blog.bazel.build/2017/06/28/sjd-unused_deps.html |
Google (and Bazel rules_typescript) use a special-purpose TypeScript compiler. One of the reasons for this is we want to enforce strict dependencies.
Strict dependencies means you may only import or reference symbols declared in a project you explicitly declare to be an input. This is an essential property in a large monorepo as a defense against accidental coupling between projects.
For example we might have three directories, A B and C:
Let's say we work on library B. We decide we no longer need to depend on A, so we remove the dependency, but this breaks users such as C. This is a serious impediment to good code practices because our dependency on A leaked to users who reference its symbols without declaring their own dependency. In a big monorepo, the breakage of removing a dependency can prevent ever cleaning them up
We would like to propose a strictness setting when used with Project References, such that imports (or ambient references) from transitive dependencies should be disallowed.
/cc @evmar @josephperrott
The text was updated successfully, but these errors were encountered: