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(builtin): add transitive typings to runfiles provider produced by js_library #2547

Merged

Conversation

mattem
Copy link
Collaborator

@mattem mattem commented Mar 22, 2021

Add transitive typings to runfiles provider produced by js_library. Allows downstream consumers that require the .d.ts files at runtime (eg typechecking) to access the files via the runfiles tree.

@alexeagle
Copy link
Collaborator

I'm surprised this is useful, what's the use case? a typescript program deps on a binary and wants to typecheck against some library code contained in that binary?

@mattem
Copy link
Collaborator Author

mattem commented Mar 22, 2021

Yeah, internally running tsc_test to perform typechecking, where one of the dependencies is via a js_library which outputs the required .d.ts files. There is an alternative method, js_library outputs types to an output group types, so it's possible to do:

filegroup(
    name = "types_dts",
    srcs = [
        "//some:js_library"
    ],
    output_group = "types",
)

tsc_test(
    name = "typecheck",
    args = [
        "--noEmit",
        "--incremental",
        "false",
    ],
    chdir = package_name(),
    data = [
        ":types_dts",
        ...
    ],
)

@mattem mattem force-pushed the fix/nodejs_binary_declaration_info branch from 4fed67f to 3daba63 Compare March 24, 2021 12:52
@mattem mattem changed the title fix(builtin): pass though declarations from DeclarationInfo provider in nodejs_binary fix(builtin): add transitive typings to runfiles provider produced by js_library Mar 24, 2021
@mattem
Copy link
Collaborator Author

mattem commented Mar 24, 2021

//examples:examples_protobufjs flake

@alexeagle alexeagle merged commit 41117fa into bazel-contrib:stable Mar 24, 2021
@mattem mattem deleted the fix/nodejs_binary_declaration_info branch March 24, 2021 21:09
alexeagle added a commit that referenced this pull request Jan 6, 2022
…duced by js_library (#2547)"

This wasn't actually a fix - it causes type-checking to happen eagerly
when a js_library target is built, even if the typings aren't needed.

This prevents a transpile-only dev workflow.

As noted in the PR #2547
this is easily accomplished in tsc_test by explicitly gathering typings
inputs with output_group = types

This reverts commit 41117fa.
alexeagle added a commit that referenced this pull request Jan 6, 2022
…duced by js_library (#2547)"

This wasn't actually a fix - it causes type-checking to happen eagerly
when a js_library target is built, even if the typings aren't needed.

This prevents a transpile-only dev workflow.

As noted in the PR #2547
this is easily accomplished in tsc_test by explicitly gathering typings
inputs with output_group = types

This reverts commit 41117fa.
alexeagle added a commit that referenced this pull request Jan 6, 2022
…duced by js_library (#2547)" (#3189)

This wasn't actually a fix - it causes type-checking to happen eagerly
when a js_library target is built, even if the typings aren't needed.

This prevents a transpile-only dev workflow.

As noted in the PR #2547
this is easily accomplished in tsc_test by explicitly gathering typings
inputs with output_group = types

This reverts commit 41117fa.
alexeagle added a commit that referenced this pull request Jan 7, 2022
…duced by js_library (#2547)" (#3189)

This wasn't actually a fix - it causes type-checking to happen eagerly
when a js_library target is built, even if the typings aren't needed.

This prevents a transpile-only dev workflow.

As noted in the PR #2547
this is easily accomplished in tsc_test by explicitly gathering typings
inputs with output_group = types

This reverts commit 41117fa.
alexeagle added a commit that referenced this pull request Jan 8, 2022
…duced by js_library (#2547)" (#3189)

This wasn't actually a fix - it causes type-checking to happen eagerly
when a js_library target is built, even if the typings aren't needed.

This prevents a transpile-only dev workflow.

As noted in the PR #2547
this is easily accomplished in tsc_test by explicitly gathering typings
inputs with output_group = types

This reverts commit 41117fa.
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.

3 participants