Skip to content

Commit

Permalink
fix: include declarations in files of generated tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan committed Feb 11, 2023
1 parent 914bb40 commit 77cc0c0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
13 changes: 13 additions & 0 deletions examples/global_dts/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")

ts_project(
name = "lib",
srcs = [
"global.d.ts",
"index.ts",
],
tsconfig = {
"declaration": True,
},
visibility = ["//examples:__subpackages__"],
)
1 change: 1 addition & 0 deletions examples/global_dts/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare function myGlobalFunction(a: number): string
1 change: 1 addition & 0 deletions examples/global_dts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
myGlobalFunction(42)
5 changes: 3 additions & 2 deletions ts/private/ts_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _ts_config_impl(ctx):
include_transitive_sources = True,
include_declarations = True,
include_npm_linked_packages = True,
)
),
]

for dep in ctx.attr.deps:
Expand Down Expand Up @@ -74,7 +74,8 @@ def _filter_input_files(files, allow_js, resolve_json_module):
return [
f
for f in files
if _lib.is_ts_src(f.basename, allow_js) or _lib.is_json_src(f.basename, resolve_json_module)
# include typescript, json & declaration sources
if _lib.is_ts_src(f.basename, allow_js) or _lib.is_json_src(f.basename, resolve_json_module) or _lib.is_typings_src(f.basename)
]

def _write_tsconfig_rule(ctx):
Expand Down

0 comments on commit 77cc0c0

Please sign in to comment.