Skip to content

Commit

Permalink
refactor: make our full set of typings mutually compatible (#2617)
Browse files Browse the repository at this point in the history
By not installing @types/jest and @types/jasmine together, we avoid TS having type conflicts when running outside the sandbox.
This makes it a lot easier to make compiles succeed on windows for example, which trips a lot of first-time contributors
  • Loading branch information
alexeagle authored Apr 21, 2021
1 parent b0175cd commit 00b5afd
Show file tree
Hide file tree
Showing 36 changed files with 14 additions and 40 deletions.
3 changes: 1 addition & 2 deletions internal/linker/test/local/fit/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"declaration": true,
"types": []
"declaration": true
}
}
2 changes: 1 addition & 1 deletion internal/linker/test/multi_linker/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ checked_in_ts_project(
src = "test.ts",
checked_in_js = "checked_in_test.js",
deps = [
"@npm//@types/jest",
"@npm//@types/jasmine",
"@npm//@types/node",
],
)
Expand Down
2 changes: 1 addition & 1 deletion internal/linker/test/multi_linker/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"compilerOptions": {
"types": ["node", "jest"]
"types": ["node", "jasmine"]
}
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@gregmagolan/test-a": "0.0.5",
"@types/hammerjs": "2.0.35",
"@types/jasmine": "~3.3.13",
"@types/jest": "24.9.0",
"@types/node": "^12.0.0",
"@types/semver": "6.2.0",
"babel-jest": "^25.5.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ Uses ts_library prodmode esm output"""
name = "%s_ts" % name,
srcs = srcs,
data = data,
deps = deps + ["@npm//@types/jest"],
# Ideally we'd use @types/jest, but it causes typings conflicts
# if installed together with @types/jasmine and they both end up
# ambiently included in a TS compile
deps = deps + ["@npm//@types/jasmine"],
# NB: hacky hidden configuration setting so that es6_sources does not include tsickle
# .externs.js outputs
runtime = "nodejs",
Expand Down
1 change: 0 additions & 1 deletion packages/typescript/test/ts_project/allow_js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"types": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"types": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"types": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"types": []
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"files": ["a.d.ts"],
"compilerOptions": {
"types": []
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"files": [],
"compilerOptions": {
"types": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
"../../../../../bazel-out/k8-dbg/bin/packages/typescript/test/ts_project/empty_intermediate",
"../../../../../bazel-out/x64_windows-dbg/bin/packages/typescript/test/ts_project/empty_intermediate",
],
"types": []
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"noImplicitAny": true,
"types": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ ts_project(
"declarationDir": "types",
"declarationMap": True,
"module": "esnext",
"moduleResolution": "node",
"outDir": "out",
"rootDir": "src",
"sourceMap": True,
"types": [],
},
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ts_project(
tsconfig = {
"compilerOptions": {
"module": "esnext",
"types": [],
"moduleResolution": "node",
},
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ ts_project(
"compilerOptions": {
"declaration": True,
"emitDeclarationOnly": True,
"types": [],
},
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ load("//packages/typescript:index.bzl", "ts_project")
ts_project(
tsconfig = {
"compilerOptions": {
"types": [],
},
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ ts_project(
"compilerOptions": {
"declaration": True,
"outDir": "case_one",
"types": [],
},
},
)
Expand All @@ -30,7 +29,6 @@ ts_project(
"compilerOptions": {
"declaration": True,
"outDir": "case_two",
"types": [],
},
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ ts_project(
tsconfig = {
"compilerOptions": {
"rootDir": "subdir",
"types": [],
},
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ ts_project(
tsconfig = {
"compilerOptions": {
"moduleResolution": "Node",
"types": [],
},
},
deps = ["//packages/typescript/test/ts_project/import_package_by_name/lib"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ts_project(
tsconfig = {
"compilerOptions": {
"declaration": True,
"types": [],
},
},
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"files": ["b.ts"],
"compilerOptions": {
"types": [],
// Help TypeScript locate the a.d.ts file from dep.
// Note that it comes from a js_library which means the .d.ts file is copied to the bazel-out folder.
// Needed when running in a sandbox or remote.
Expand Down
1 change: 0 additions & 1 deletion packages/typescript/test/ts_project/json/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ ts_project(
"declaration": True,
"emitDeclarationOnly": True,
"resolveJsonModule": True,
"types": [],
},
},
)
Expand Down
1 change: 0 additions & 1 deletion packages/typescript/test/ts_project/json/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"types": [],
"resolveJsonModule": true
}
}
3 changes: 1 addition & 2 deletions packages/typescript/test/ts_project/jsx/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"jsx": "preserve",
"types": []
"jsx": "preserve"
}
}
2 changes: 2 additions & 0 deletions packages/typescript/test/ts_project/outdir/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ load("//packages/typescript:index.bzl", "ts_project")
args = [
"--module",
format,
"--moduleResolution",
"node",
],
# Write the output files to an extra nested directory
out_dir = format,
Expand Down
1 change: 0 additions & 1 deletion packages/typescript/test/ts_project/outdir/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"compilerOptions": {
"types": []
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"types": [],
"declaration": true
}
}
1 change: 0 additions & 1 deletion packages/typescript/test/ts_project/rootdir/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"compilerOptions": {
"types": []
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"compilerOptions": {
"types": []
}
}
1 change: 0 additions & 1 deletion packages/typescript/test/ts_project/simple/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"compilerOptions": {
"types": []
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"extends": "./tsconfig-extended.json",
"compilerOptions": {
"types": []
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "my.tsbuildinfo",
"types": []
"tsBuildInfoFile": "my.tsbuildinfo"
}
}
1 change: 0 additions & 1 deletion packages/typescript/test/ts_project/tsconfig-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@
"../../../../bazel-out/k8-dbg/bin/packages/typescript/test/ts_project",
"../../../../bazel-out/x64_windows-dbg/bin/packages/typescript/test/ts_project",
],
"types": []
}
}
3 changes: 1 addition & 2 deletions packages/typescript/test/ts_project/validation/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"composite": true,
"declarationMap": true,
"declaration": true,
"sourceMap": true,
"types": []
"sourceMap": true
}
}
1 change: 0 additions & 1 deletion packages/typescript/test/ts_project/worker/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ts_project(
tsconfig = {
"compilerOptions": {
"declaration": True,
"types": [],
},
},
)

0 comments on commit 00b5afd

Please sign in to comment.