aspect-build / aspect-build/rules_ts

ts_project should filter .ts transitive inputs

Open
#170 3 comments 0 reactions 0 assignees View on GitHub
blocked enhancement
Dominant language
Starlark
Stars
138
Forks
87
Avg merge
2d 8h
Merged PRs (30d)
3

Description

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.

Contributor guide

Open the contributing guide

Research direction

Start at the ts_project rule implementation and its tests, tracing how transitive .ts and .d.ts inputs are collected into the sandbox. Confirm that transitive .d.ts files remain available while transitive .ts files are excluded, and add or update coverage for the dependency scenario described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.