Skip to content
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

ts_project should filter .ts transitive inputs #170

Open
mrmeku opened this issue Oct 11, 2022 · 3 comments
Open

ts_project should filter .ts transitive inputs #170

mrmeku opened this issue Oct 11, 2022 · 3 comments
Labels
blocked Blocked by another issue enhancement New feature or request

Comments

@mrmeku
Copy link
Contributor

mrmeku commented Oct 11, 2022

Sometimes a ts_project might depend on a target which has both .ts source files and .d.ts compiled outputs in it (there are a variety of use cases for this but the most common is that you want to have your javascript bundler be able to run without invoking the typescript type checker. The bundler will depend on the .ts source files only and not the compiled .d.ts files).

For example:

srcs = ["index.tx"]

ts_project(
  name = "tsc"
  srcs = srcs
)

# source files required for the bundler (css and image files)
bundling_srcs = ["index.css"]
js_library(
  srcs = srcs + bundling_srcs,
  # Depend on tsc compiler output so that downstream ts_project's can pick up .d.ts files
  deps = [":tsc"]
)

In these cases, the .d.ts files should be included in the sandbox and the .ts files should be excluded from the sandbox. Including the .ts sources breaks the semantics or typescript projects since all source files need to be contained under the root directory of the typescript compilation. .ts files from transitive deps will not be under the correct root directory. Furthermore, we do not want to re-compile these sources since they've already been compiled.

@jbedard jbedard added the discussion needed Discussion required to progress further label Oct 11, 2022
@cgrindel cgrindel added the enhancement New feature or request label Oct 12, 2022
@thesayyn
Copy link
Member

I bumped into this problem frequently while developing the worker mode for ts_project. tsc will prefer .ts over other extensions, unfortunately.

Doing this will come at a cost, however, as we'd have to recursively search the dependency graph.

@alexeagle
Copy link
Member

I think microsoft/TypeScript#22208 is the actual issue here, there's no way for us to properly invoke tsc. It's labelled committed so maybe we could fix it?

@cgrindel
Copy link

We will put this on the prioritized list, but it is blocked by the fix for microsoft/TypeScript#22208.

@cgrindel cgrindel added prioritized and removed discussion needed Discussion required to progress further labels Oct 13, 2022
@gregmagolan gregmagolan moved this to 📋 Backlog in Open Source Feb 5, 2023
@gregmagolan gregmagolan added the blocked Blocked by another issue label Feb 5, 2023
@gregmagolan gregmagolan moved this from 📋 Backlog to 🛑 Blocked in Open Source Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked by another issue enhancement New feature or request
Projects
Status: 🛑 Blocked
Development

No branches or pull requests

6 participants