@@ -45,13 +45,12 @@ def _ts_project_module_impl(ctx):
45
45
# Filter runfiles to not `node_modules` from Aspect as this interop
46
46
# target is supposed to be used downstream by `rules_nodejs` consumers,
47
47
# and mixing pnpm-style node modules with linker node modules is incompatible.
48
- filtered = []
48
+ filtered_runfiles = []
49
49
for f in runfiles .files .to_list ():
50
50
if f .short_path .startswith ("node_modules/" ):
51
51
continue
52
- filtered .append (f )
53
-
54
- runfiles = ctx .runfiles (files = filtered )
52
+ filtered_runfiles .append (f )
53
+ runfiles = ctx .runfiles (files = filtered_runfiles )
55
54
56
55
providers = [
57
56
DefaultInfo (
@@ -62,8 +61,8 @@ def _ts_project_module_impl(ctx):
62
61
sources = depset (transitive = [info .transitive_sources ]),
63
62
),
64
63
DeclarationInfo (
65
- declarations = info .types ,
66
- transitive_declarations = info .transitive_types ,
64
+ declarations = _filter_types_depset ( info .types ) ,
65
+ transitive_declarations = _filter_types_depset ( info .transitive_types ) ,
67
66
type_blocklisted_declarations = depset (),
68
67
),
69
68
]
@@ -135,3 +134,17 @@ def ts_project(name, module_name = None, interop_deps = [], deps = [], testonly
135
134
deps = [] + interop_deps + deps ,
136
135
module_name = module_name ,
137
136
)
137
+
138
+ # Filter type provider to not include `.json` files. `ts_config`
139
+ # targets are included in `ts_project` and their tsconfig json file
140
+ # is included as type. See:
141
+ # https://github.com/aspect-build/rules_ts/blob/main/ts/private/ts_config.bzl#L55C63-L55C68.
142
+ def _filter_types_depset (types_depset ):
143
+ types = []
144
+
145
+ for t in types_depset .to_list ():
146
+ if t .short_path .endswith (".json" ):
147
+ continue
148
+ types .append (t )
149
+
150
+ return depset (types )
0 commit comments