1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-22 06:09:25 -05:00

chore(std): Remove tsconfig_test.json (#8629)

Ref #8050
This commit is contained in:
Nayeem Rahman 2020-12-07 10:49:58 +00:00 committed by GitHub
parent 301d3e4b68
commit b77d6cb29e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 25 deletions

View file

@ -10,7 +10,6 @@ use test_util as util;
#[test] #[test]
fn std_tests() { fn std_tests() {
let dir = TempDir::new().expect("tempdir fail"); let dir = TempDir::new().expect("tempdir fail");
let std_config = util::root_path().join("std/tsconfig_test.json");
let status = util::deno_cmd() let status = util::deno_cmd()
.env("DENO_DIR", dir.path()) .env("DENO_DIR", dir.path())
.current_dir(util::root_path()) .current_dir(util::root_path())
@ -18,8 +17,6 @@ fn std_tests() {
.arg("--unstable") .arg("--unstable")
.arg("--seed=86") // Some tests rely on specific random numbers. .arg("--seed=86") // Some tests rely on specific random numbers.
.arg("-A") .arg("-A")
.arg("--config")
.arg(std_config.to_str().unwrap())
// .arg("-Ldebug") // .arg("-Ldebug")
.arg("std/") .arg("std/")
.spawn() .spawn()

View file

@ -23,23 +23,20 @@ useful when type checking is provided by your editor and you want startup time
to be as fast as possible (for example when restarting the program automatically to be as fast as possible (for example when restarting the program automatically
with a file watcher). with a file watcher).
Because `--no-check` does not do TypeScript type checking we can not To make the most of skipping type checks, `--no-check` transpiles each module in
automatically remove type only imports and exports as this would require type isolation without using information from imported modules. This maximizes
information. For this purpose TypeScript provides the potential for concurrency and incremental rebuilds. On the other hand, the
[`import type` and `export type` syntax](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-exports). transpiler cannot know if `export { Foo } from "./foo.ts"` should be preserved
To export a type in a different file use (in case `Foo` is a value) or removed (in case `Foo` is strictly a type). To
`export type { AnInterface } from "./mod.ts";`. To import a type use resolve such ambiguities, Deno enforces
`import type { AnInterface } from "./mod.ts";`. You can check that you are using [`isolatedModules`](https://www.typescriptlang.org/tsconfig#isolatedModules) on
`import type` and `export type` where necessary by setting the `isolatedModules` all TS code. This means that `Foo` in the above example must be a value, and the
TypeScript compiler option to `true`, and the `importsNotUsedAsValues` to [`export type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-exports)
`error`. You can see an example `tsconfig.json` with this option syntax must be used instead if `Foo` is a type.
[in the standard library](https://github.com/denoland/deno/blob/$CLI_VERSION/std/tsconfig_test.json).
These settings will be enabled by default in the future. They are already the
default in Deno 1.4 or above when using `--unstable`.
Because there is no type information when using `--no-check`, `const enum` is Another consequence of `isolatedModules` is that the type-directed `const enum`
not supported because it is type-directed. `--no-check` also does not support is treated like `enum`. The legacy `import =` and `export =` syntaxes are also
the legacy `import =` and `export =` syntax. not supported by `--no-check`.
### Using external type definitions ### Using external type definitions
@ -90,7 +87,7 @@ definition which happens to be alongside that file, your JavaScript module named
export const foo = "foo"; export const foo = "foo";
``` ```
Deno will see this, and the compiler will use `foo.d.ts` when type checking the Deno will see this, and the compiler will use `foo.d.ts` when type-checking the
file, though `foo.js` will be loaded at runtime. The resolution of the value of file, though `foo.js` will be loaded at runtime. The resolution of the value of
the directive follows the same resolution logic as importing a module, meaning the directive follows the same resolution logic as importing a module, meaning
the file needs to have an extension and is relative to the current file. Remote the file needs to have an extension and is relative to the current file. Remote

View file

@ -1,5 +0,0 @@
{
"compilerOptions": {
"isolatedModules": true
}
}