@@ -45,13 +45,12 @@ def _ts_project_module_impl(ctx):
4545 # Filter runfiles to not `node_modules` from Aspect as this interop
4646 # target is supposed to be used downstream by `rules_nodejs` consumers,
4747 # and mixing pnpm-style node modules with linker node modules is incompatible.
48- filtered = []
48+ filtered_runfiles = []
4949 for f in runfiles .files .to_list ():
5050 if f .short_path .startswith ("node_modules/" ):
5151 continue
52- filtered .append (f )
53-
54- runfiles = ctx .runfiles (files = filtered )
52+ filtered_runfiles .append (f )
53+ runfiles = ctx .runfiles (files = filtered_runfiles )
5554
5655 providers = [
5756 DefaultInfo (
@@ -62,8 +61,8 @@ def _ts_project_module_impl(ctx):
6261 sources = depset (transitive = [info .transitive_sources ]),
6362 ),
6463 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 ) ,
6766 type_blocklisted_declarations = depset (),
6867 ),
6968 ]
@@ -135,3 +134,17 @@ def ts_project(name, module_name = None, interop_deps = [], deps = [], testonly
135134 deps = [] + interop_deps + deps ,
136135 module_name = module_name ,
137136 )
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