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

fix(typescript): update documentation now that ts_project is recommended #2548

Merged
merged 1 commit into from
Mar 24, 2021

Conversation

alexeagle
Copy link
Collaborator

We don't deprecate ts_library yet

Then call it, using the [`npm_package_bin`](Built-ins#npm_package_bin) documentation.

Here is an example:
https://github.com/bazelbuild/rules_nodejs/blob/stable/internal/node/test/BUILD.bazel#L491-L507
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: don't link to the lines as they will likely change and we'll forget to update the docs

"An example of using tsc directly can be seen in the nodejs tests BUILD.bazel file"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to point to the right spot in the file too, it's very long. I pinned to 3.2.2 rather than stable so we don't break the link


### ts_project

`ts_project` simply runs `tsc --project`, with Bazel knowing which outputs to expect based on the TypeScript compiler options, and with interoperability with other TypeScript rules via a Bazel Provider (DeclarationInfo) that transmits the type information.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link to provider docs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah - it's so hard to get the links right tho, so they work in both markdown and on the rendered docsite, let's try...

Here, `//path/to/other:library` is another target in your repo that produces TypeScript typings (for example, another `ts_project` rule). To use third-party libraries from npm, first install them (likely using `npm_install` or `yarn_install` rules) then add those to the `deps` as well:

```starlark
ts_library(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean ts_project?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops!

@alexeagle alexeagle merged commit a8d8b0f into bazel-contrib:stable Mar 24, 2021
@alexeagle alexeagle deleted the no_ts_library branch March 24, 2021 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants