From 00b5afd3fd5d66c3f2e7ba4bf19938fa139b304c Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Wed, 21 Apr 2021 12:53:29 -0700 Subject: [PATCH] refactor: make our full set of typings mutually compatible (#2617) 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 --- internal/linker/test/local/fit/tsconfig.json | 3 +-- internal/linker/test/multi_linker/BUILD.bazel | 2 +- internal/linker/test/multi_linker/tsconfig.json | 2 +- package.json | 1 - .../test/ts_library_esm_with_jest/ts_jest_test.bzl | 5 ++++- packages/typescript/test/ts_project/allow_js/tsconfig.json | 1 - .../test/ts_project/declaration_only/tsconfig.json | 1 - .../typescript/test/ts_project/declarationdir/tsconfig.json | 1 - .../test/ts_project/declarationdir_with_value/tsconfig.json | 1 - .../test/ts_project/empty_intermediate/tsconfig-a.json | 1 - .../test/ts_project/empty_intermediate/tsconfig-b.json | 1 - .../test/ts_project/empty_intermediate/tsconfig-c.json | 1 - .../test/ts_project/extends_chain/tsconfig.base.json | 1 - .../test/ts_project/generated_tsconfig/config/BUILD.bazel | 2 +- .../ts_project/generated_tsconfig/config_attrs/BUILD.bazel | 2 +- .../test/ts_project/generated_tsconfig/decl_only/BUILD.bazel | 1 - .../test/ts_project/generated_tsconfig/default/BUILD.bazel | 1 - .../test/ts_project/generated_tsconfig/extends/BUILD.bazel | 2 -- .../test/ts_project/generated_tsconfig/gen_src/BUILD.bazel | 1 - .../test/ts_project/import_package_by_name/app/BUILD.bazel | 1 - .../test/ts_project/import_package_by_name/lib/BUILD.bazel | 1 - packages/typescript/test/ts_project/js_library/tsconfig.json | 1 - packages/typescript/test/ts_project/json/BUILD.bazel | 1 - packages/typescript/test/ts_project/json/tsconfig.json | 1 - packages/typescript/test/ts_project/jsx/tsconfig.json | 3 +-- packages/typescript/test/ts_project/outdir/BUILD.bazel | 2 ++ packages/typescript/test/ts_project/outdir/tsconfig.json | 1 - .../typescript/test/ts_project/output_group/tsconfig.json | 1 - packages/typescript/test/ts_project/rootdir/tsconfig.json | 1 - .../test/ts_project/rootdir_with_value/tsconfig.json | 1 - packages/typescript/test/ts_project/simple/tsconfig.json | 1 - packages/typescript/test/ts_project/ts_config/tsconfig.json | 1 - .../typescript/test/ts_project/tsbuildinfofile/tsconfig.json | 3 +-- packages/typescript/test/ts_project/tsconfig-base.json | 1 - packages/typescript/test/ts_project/validation/tsconfig.json | 3 +-- packages/typescript/test/ts_project/worker/BUILD.bazel | 1 - 36 files changed, 14 insertions(+), 40 deletions(-) diff --git a/internal/linker/test/local/fit/tsconfig.json b/internal/linker/test/local/fit/tsconfig.json index 67dcdc9d6a..8f1cc9cec2 100644 --- a/internal/linker/test/local/fit/tsconfig.json +++ b/internal/linker/test/local/fit/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "declaration": true, - "types": [] + "declaration": true } } \ No newline at end of file diff --git a/internal/linker/test/multi_linker/BUILD.bazel b/internal/linker/test/multi_linker/BUILD.bazel index 5471999ee5..295e8e63a4 100644 --- a/internal/linker/test/multi_linker/BUILD.bazel +++ b/internal/linker/test/multi_linker/BUILD.bazel @@ -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", ], ) diff --git a/internal/linker/test/multi_linker/tsconfig.json b/internal/linker/test/multi_linker/tsconfig.json index e89edbac6c..d80d283ba3 100644 --- a/internal/linker/test/multi_linker/tsconfig.json +++ b/internal/linker/test/multi_linker/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "types": ["node", "jest"] + "types": ["node", "jasmine"] } } diff --git a/package.json b/package.json index 3e550b526d..a58ab6fa4e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/typescript/test/ts_library_esm_with_jest/ts_jest_test.bzl b/packages/typescript/test/ts_library_esm_with_jest/ts_jest_test.bzl index 4c531eedb3..5de1f80f11 100644 --- a/packages/typescript/test/ts_library_esm_with_jest/ts_jest_test.bzl +++ b/packages/typescript/test/ts_library_esm_with_jest/ts_jest_test.bzl @@ -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", diff --git a/packages/typescript/test/ts_project/allow_js/tsconfig.json b/packages/typescript/test/ts_project/allow_js/tsconfig.json index f0c07acb4b..09fc3886c7 100644 --- a/packages/typescript/test/ts_project/allow_js/tsconfig.json +++ b/packages/typescript/test/ts_project/allow_js/tsconfig.json @@ -4,6 +4,5 @@ "sourceMap": true, "declaration": true, "declarationMap": true, - "types": [] } } diff --git a/packages/typescript/test/ts_project/declaration_only/tsconfig.json b/packages/typescript/test/ts_project/declaration_only/tsconfig.json index e929240d2d..75b30e353d 100644 --- a/packages/typescript/test/ts_project/declaration_only/tsconfig.json +++ b/packages/typescript/test/ts_project/declaration_only/tsconfig.json @@ -2,6 +2,5 @@ "compilerOptions": { "declaration": true, "emitDeclarationOnly": true, - "types": [] } } diff --git a/packages/typescript/test/ts_project/declarationdir/tsconfig.json b/packages/typescript/test/ts_project/declarationdir/tsconfig.json index 098887abfd..69f8a3ceaf 100644 --- a/packages/typescript/test/ts_project/declarationdir/tsconfig.json +++ b/packages/typescript/test/ts_project/declarationdir/tsconfig.json @@ -3,6 +3,5 @@ "sourceMap": true, "declaration": true, "declarationMap": true, - "types": [] } } diff --git a/packages/typescript/test/ts_project/declarationdir_with_value/tsconfig.json b/packages/typescript/test/ts_project/declarationdir_with_value/tsconfig.json index 098887abfd..69f8a3ceaf 100644 --- a/packages/typescript/test/ts_project/declarationdir_with_value/tsconfig.json +++ b/packages/typescript/test/ts_project/declarationdir_with_value/tsconfig.json @@ -3,6 +3,5 @@ "sourceMap": true, "declaration": true, "declarationMap": true, - "types": [] } } diff --git a/packages/typescript/test/ts_project/empty_intermediate/tsconfig-a.json b/packages/typescript/test/ts_project/empty_intermediate/tsconfig-a.json index 7bafa424da..e4c7d614ff 100644 --- a/packages/typescript/test/ts_project/empty_intermediate/tsconfig-a.json +++ b/packages/typescript/test/ts_project/empty_intermediate/tsconfig-a.json @@ -1,6 +1,5 @@ { "files": ["a.d.ts"], "compilerOptions": { - "types": [] } } \ No newline at end of file diff --git a/packages/typescript/test/ts_project/empty_intermediate/tsconfig-b.json b/packages/typescript/test/ts_project/empty_intermediate/tsconfig-b.json index 3b87315842..7f5c9cf5f8 100644 --- a/packages/typescript/test/ts_project/empty_intermediate/tsconfig-b.json +++ b/packages/typescript/test/ts_project/empty_intermediate/tsconfig-b.json @@ -1,6 +1,5 @@ { "files": [], "compilerOptions": { - "types": [] } } \ No newline at end of file diff --git a/packages/typescript/test/ts_project/empty_intermediate/tsconfig-c.json b/packages/typescript/test/ts_project/empty_intermediate/tsconfig-c.json index f0b748b3d5..dcdbec4409 100644 --- a/packages/typescript/test/ts_project/empty_intermediate/tsconfig-c.json +++ b/packages/typescript/test/ts_project/empty_intermediate/tsconfig-c.json @@ -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": [] } } \ No newline at end of file diff --git a/packages/typescript/test/ts_project/extends_chain/tsconfig.base.json b/packages/typescript/test/ts_project/extends_chain/tsconfig.base.json index da332ac9d2..6b68e69daa 100644 --- a/packages/typescript/test/ts_project/extends_chain/tsconfig.base.json +++ b/packages/typescript/test/ts_project/extends_chain/tsconfig.base.json @@ -1,6 +1,5 @@ { "compilerOptions": { "noImplicitAny": true, - "types": [] } } diff --git a/packages/typescript/test/ts_project/generated_tsconfig/config/BUILD.bazel b/packages/typescript/test/ts_project/generated_tsconfig/config/BUILD.bazel index 204dcbf3a9..d163c0d962 100644 --- a/packages/typescript/test/ts_project/generated_tsconfig/config/BUILD.bazel +++ b/packages/typescript/test/ts_project/generated_tsconfig/config/BUILD.bazel @@ -10,10 +10,10 @@ ts_project( "declarationDir": "types", "declarationMap": True, "module": "esnext", + "moduleResolution": "node", "outDir": "out", "rootDir": "src", "sourceMap": True, - "types": [], }, }, ) diff --git a/packages/typescript/test/ts_project/generated_tsconfig/config_attrs/BUILD.bazel b/packages/typescript/test/ts_project/generated_tsconfig/config_attrs/BUILD.bazel index 67bbf37020..b31c0811cf 100644 --- a/packages/typescript/test/ts_project/generated_tsconfig/config_attrs/BUILD.bazel +++ b/packages/typescript/test/ts_project/generated_tsconfig/config_attrs/BUILD.bazel @@ -13,7 +13,7 @@ ts_project( tsconfig = { "compilerOptions": { "module": "esnext", - "types": [], + "moduleResolution": "node", }, }, ) diff --git a/packages/typescript/test/ts_project/generated_tsconfig/decl_only/BUILD.bazel b/packages/typescript/test/ts_project/generated_tsconfig/decl_only/BUILD.bazel index 9462681e90..acfc1c0c54 100644 --- a/packages/typescript/test/ts_project/generated_tsconfig/decl_only/BUILD.bazel +++ b/packages/typescript/test/ts_project/generated_tsconfig/decl_only/BUILD.bazel @@ -7,7 +7,6 @@ ts_project( "compilerOptions": { "declaration": True, "emitDeclarationOnly": True, - "types": [], }, }, ) diff --git a/packages/typescript/test/ts_project/generated_tsconfig/default/BUILD.bazel b/packages/typescript/test/ts_project/generated_tsconfig/default/BUILD.bazel index fc4a6ed0ba..9cf9492b50 100644 --- a/packages/typescript/test/ts_project/generated_tsconfig/default/BUILD.bazel +++ b/packages/typescript/test/ts_project/generated_tsconfig/default/BUILD.bazel @@ -4,7 +4,6 @@ load("//packages/typescript:index.bzl", "ts_project") ts_project( tsconfig = { "compilerOptions": { - "types": [], }, }, ) diff --git a/packages/typescript/test/ts_project/generated_tsconfig/extends/BUILD.bazel b/packages/typescript/test/ts_project/generated_tsconfig/extends/BUILD.bazel index dd553d98d7..0c27188c10 100644 --- a/packages/typescript/test/ts_project/generated_tsconfig/extends/BUILD.bazel +++ b/packages/typescript/test/ts_project/generated_tsconfig/extends/BUILD.bazel @@ -9,7 +9,6 @@ ts_project( "compilerOptions": { "declaration": True, "outDir": "case_one", - "types": [], }, }, ) @@ -30,7 +29,6 @@ ts_project( "compilerOptions": { "declaration": True, "outDir": "case_two", - "types": [], }, }, ) diff --git a/packages/typescript/test/ts_project/generated_tsconfig/gen_src/BUILD.bazel b/packages/typescript/test/ts_project/generated_tsconfig/gen_src/BUILD.bazel index be87f274ca..02219d9eb0 100644 --- a/packages/typescript/test/ts_project/generated_tsconfig/gen_src/BUILD.bazel +++ b/packages/typescript/test/ts_project/generated_tsconfig/gen_src/BUILD.bazel @@ -13,7 +13,6 @@ ts_project( tsconfig = { "compilerOptions": { "rootDir": "subdir", - "types": [], }, }, ) diff --git a/packages/typescript/test/ts_project/import_package_by_name/app/BUILD.bazel b/packages/typescript/test/ts_project/import_package_by_name/app/BUILD.bazel index 12d863ebdc..acc92178ab 100644 --- a/packages/typescript/test/ts_project/import_package_by_name/app/BUILD.bazel +++ b/packages/typescript/test/ts_project/import_package_by_name/app/BUILD.bazel @@ -4,7 +4,6 @@ ts_project( tsconfig = { "compilerOptions": { "moduleResolution": "Node", - "types": [], }, }, deps = ["//packages/typescript/test/ts_project/import_package_by_name/lib"], diff --git a/packages/typescript/test/ts_project/import_package_by_name/lib/BUILD.bazel b/packages/typescript/test/ts_project/import_package_by_name/lib/BUILD.bazel index 0293a75c02..9cc3c360b3 100644 --- a/packages/typescript/test/ts_project/import_package_by_name/lib/BUILD.bazel +++ b/packages/typescript/test/ts_project/import_package_by_name/lib/BUILD.bazel @@ -5,7 +5,6 @@ ts_project( tsconfig = { "compilerOptions": { "declaration": True, - "types": [], }, }, ) diff --git a/packages/typescript/test/ts_project/js_library/tsconfig.json b/packages/typescript/test/ts_project/js_library/tsconfig.json index 77ea24fbad..812377a6a7 100644 --- a/packages/typescript/test/ts_project/js_library/tsconfig.json +++ b/packages/typescript/test/ts_project/js_library/tsconfig.json @@ -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. diff --git a/packages/typescript/test/ts_project/json/BUILD.bazel b/packages/typescript/test/ts_project/json/BUILD.bazel index be14cdba0e..f786f42c99 100644 --- a/packages/typescript/test/ts_project/json/BUILD.bazel +++ b/packages/typescript/test/ts_project/json/BUILD.bazel @@ -30,7 +30,6 @@ ts_project( "declaration": True, "emitDeclarationOnly": True, "resolveJsonModule": True, - "types": [], }, }, ) diff --git a/packages/typescript/test/ts_project/json/tsconfig.json b/packages/typescript/test/ts_project/json/tsconfig.json index dbbd345b65..5e1c023684 100644 --- a/packages/typescript/test/ts_project/json/tsconfig.json +++ b/packages/typescript/test/ts_project/json/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "types": [], "resolveJsonModule": true } } \ No newline at end of file diff --git a/packages/typescript/test/ts_project/jsx/tsconfig.json b/packages/typescript/test/ts_project/jsx/tsconfig.json index 762accd9fb..2c293a2afe 100644 --- a/packages/typescript/test/ts_project/jsx/tsconfig.json +++ b/packages/typescript/test/ts_project/jsx/tsconfig.json @@ -4,7 +4,6 @@ "sourceMap": true, "declaration": true, "declarationMap": true, - "jsx": "preserve", - "types": [] + "jsx": "preserve" } } diff --git a/packages/typescript/test/ts_project/outdir/BUILD.bazel b/packages/typescript/test/ts_project/outdir/BUILD.bazel index 80ec6c4340..96fe214ec1 100644 --- a/packages/typescript/test/ts_project/outdir/BUILD.bazel +++ b/packages/typescript/test/ts_project/outdir/BUILD.bazel @@ -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, diff --git a/packages/typescript/test/ts_project/outdir/tsconfig.json b/packages/typescript/test/ts_project/outdir/tsconfig.json index 56d9d8ed34..aa5798f3ce 100644 --- a/packages/typescript/test/ts_project/outdir/tsconfig.json +++ b/packages/typescript/test/ts_project/outdir/tsconfig.json @@ -1,5 +1,4 @@ { "compilerOptions": { - "types": [] } } diff --git a/packages/typescript/test/ts_project/output_group/tsconfig.json b/packages/typescript/test/ts_project/output_group/tsconfig.json index 1e6e3b3652..db953a729b 100644 --- a/packages/typescript/test/ts_project/output_group/tsconfig.json +++ b/packages/typescript/test/ts_project/output_group/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "types": [], "declaration": true } } \ No newline at end of file diff --git a/packages/typescript/test/ts_project/rootdir/tsconfig.json b/packages/typescript/test/ts_project/rootdir/tsconfig.json index e98f617914..98799b0d4e 100644 --- a/packages/typescript/test/ts_project/rootdir/tsconfig.json +++ b/packages/typescript/test/ts_project/rootdir/tsconfig.json @@ -1,5 +1,4 @@ { "compilerOptions": { - "types": [] } } \ No newline at end of file diff --git a/packages/typescript/test/ts_project/rootdir_with_value/tsconfig.json b/packages/typescript/test/ts_project/rootdir_with_value/tsconfig.json index 56d9d8ed34..aa5798f3ce 100644 --- a/packages/typescript/test/ts_project/rootdir_with_value/tsconfig.json +++ b/packages/typescript/test/ts_project/rootdir_with_value/tsconfig.json @@ -1,5 +1,4 @@ { "compilerOptions": { - "types": [] } } diff --git a/packages/typescript/test/ts_project/simple/tsconfig.json b/packages/typescript/test/ts_project/simple/tsconfig.json index 56d9d8ed34..aa5798f3ce 100644 --- a/packages/typescript/test/ts_project/simple/tsconfig.json +++ b/packages/typescript/test/ts_project/simple/tsconfig.json @@ -1,5 +1,4 @@ { "compilerOptions": { - "types": [] } } diff --git a/packages/typescript/test/ts_project/ts_config/tsconfig.json b/packages/typescript/test/ts_project/ts_config/tsconfig.json index 3f14391a0e..10fb47e695 100644 --- a/packages/typescript/test/ts_project/ts_config/tsconfig.json +++ b/packages/typescript/test/ts_project/ts_config/tsconfig.json @@ -1,6 +1,5 @@ { "extends": "./tsconfig-extended.json", "compilerOptions": { - "types": [] } } diff --git a/packages/typescript/test/ts_project/tsbuildinfofile/tsconfig.json b/packages/typescript/test/ts_project/tsbuildinfofile/tsconfig.json index 4f34f64477..7b3ab1ed35 100644 --- a/packages/typescript/test/ts_project/tsbuildinfofile/tsconfig.json +++ b/packages/typescript/test/ts_project/tsbuildinfofile/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { "composite": true, - "tsBuildInfoFile": "my.tsbuildinfo", - "types": [] + "tsBuildInfoFile": "my.tsbuildinfo" } } diff --git a/packages/typescript/test/ts_project/tsconfig-base.json b/packages/typescript/test/ts_project/tsconfig-base.json index f55cc65503..11a249c71d 100644 --- a/packages/typescript/test/ts_project/tsconfig-base.json +++ b/packages/typescript/test/ts_project/tsconfig-base.json @@ -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": [] } } \ No newline at end of file diff --git a/packages/typescript/test/ts_project/validation/tsconfig.json b/packages/typescript/test/ts_project/validation/tsconfig.json index c37be6a0d4..adda9d1743 100644 --- a/packages/typescript/test/ts_project/validation/tsconfig.json +++ b/packages/typescript/test/ts_project/validation/tsconfig.json @@ -4,7 +4,6 @@ "composite": true, "declarationMap": true, "declaration": true, - "sourceMap": true, - "types": [] + "sourceMap": true } } \ No newline at end of file diff --git a/packages/typescript/test/ts_project/worker/BUILD.bazel b/packages/typescript/test/ts_project/worker/BUILD.bazel index 1abe48d0de..02afbe01ef 100644 --- a/packages/typescript/test/ts_project/worker/BUILD.bazel +++ b/packages/typescript/test/ts_project/worker/BUILD.bazel @@ -5,7 +5,6 @@ ts_project( tsconfig = { "compilerOptions": { "declaration": True, - "types": [], }, }, )