Skip to content

Commit f265538

Browse files
Simplify tsconfig files; add a second test case for the conflict error.
1 parent 0add9ab commit f265538

File tree

5 files changed

+49
-46
lines changed

5 files changed

+49
-46
lines changed

examples/ts_js_interop/BUILD.bazel

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ load("@aspect_rules_swc//swc:defs.bzl", "swc")
33
load("@bazel_skylib//lib:partial.bzl", "partial")
44

55
ts_project(
6-
name = "src",
6+
name = "a_b",
77
srcs = [
88
"a.js",
99
"b.ts",
@@ -20,6 +20,26 @@ ts_project(
2020
)
2121

2222
filegroup(
23-
name = "transpiled_srcs",
23+
name = "transpiled_a_b",
24+
# Expect this source to be generated by swc transpilation.
2425
srcs = ["b.js"],
2526
)
27+
28+
# Expect not to get:
29+
# ERROR: file 'examples/ts_js_interop/c.js' is generated by these conflicting actions:
30+
# Label: //examples/ts_js_interop:c_d_tsc, //examples/ts_js_interop:c_d_transpile
31+
ts_project(
32+
name = "c_d",
33+
srcs = [
34+
"c.js",
35+
"d.ts",
36+
],
37+
allow_js = True,
38+
declaration = True,
39+
resolve_json_module = True,
40+
transpiler = partial.make(
41+
swc,
42+
swcrc = ":.swcrc",
43+
),
44+
tsconfig = ":tsconfig.emit.json",
45+
)

examples/ts_js_interop/c.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const c = 1
2+
export default c

examples/ts_js_interop/d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import c from './c'
2+
3+
console.log(c)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"declaration": true,
4+
"moduleResolution": "node",
5+
"baseUrl": "./",
6+
"esModuleInterop": true,
7+
"rootDirs": ["."],
8+
"allowJs": true,
9+
"resolveJsonModule": true
10+
},
11+
"exclude": []
12+
}
Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,13 @@
11
{
2-
"compilerOptions": {
3-
"emitDeclarationOnly": true,
4-
"declaration": true,
5-
"jsx": "react",
6-
"moduleResolution": "node",
7-
"forceConsistentCasingInFileNames": true,
8-
"noImplicitReturns": true,
9-
"strict": true,
10-
"noUnusedLocals": true,
11-
"noUnusedParameters": true,
12-
"experimentalDecorators": true,
13-
"lib": ["dom", "es2022", "dom.iterable"],
14-
"baseUrl": "./",
15-
"paths": {
16-
"wkspc/*": ["*", "bazel-out/k8-opt/bin/*"]
2+
"compilerOptions": {
3+
"emitDeclarationOnly": true,
4+
"declaration": true,
5+
"moduleResolution": "node",
6+
"baseUrl": "./",
7+
"esModuleInterop": true,
8+
"rootDirs": ["."],
9+
"allowJs": true,
10+
"resolveJsonModule": true
1711
},
18-
"esModuleInterop": true,
19-
"downlevelIteration": true,
20-
"module": "esnext",
21-
"target": "es2020",
22-
"skipLibCheck": true,
23-
"resolveJsonModule": true,
24-
"rootDirs": [
25-
".",
26-
// Add all possible bazel-out directories
27-
// See https://github.com/microsoft/TypeScript/issues/37257
28-
"./bazel-out/darwin-dbg/bin",
29-
"./bazel-out/darwin-fastbuild/bin",
30-
"./bazel-out/k8-dbg/bin",
31-
"./bazel-out/k8-fastbuild/bin",
32-
"./bazel-out/k8-opt/bin",
33-
"./bazel-out/k8-opt-arm64/bin",
34-
"./bazel-out/x64_windows-dbg/bin",
35-
"./bazel-out/x64_windows-fastbuild/bin"
36-
],
37-
"allowJs": true,
38-
"useUnknownInCatchVariables": false,
39-
"isolatedModules": true
40-
},
41-
"exclude": [
42-
// Some typescript dependencies that get pulled in
43-
// when you set allowJs to true.
44-
"bazel-out/host/bin/external/npm/typescript/*",
45-
"bazel-out/*exec*/bin/external/npm/typescript/*"
46-
]
12+
"exclude": []
4713
}

0 commit comments

Comments
 (0)