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]
fn std_tests() {
let dir = TempDir::new().expect("tempdir fail");
let std_config = util::root_path().join("std/tsconfig_test.json");
let status = util::deno_cmd()
.env("DENO_DIR", dir.path())
.current_dir(util::root_path())
@ -18,8 +17,6 @@ fn std_tests() {
.arg("--unstable")
.arg("--seed=86") // Some tests rely on specific random numbers.
.arg("-A")
.arg("--config")
.arg(std_config.to_str().unwrap())
// .arg("-Ldebug")
.arg("std/")
.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
with a file watcher).
Because `--no-check` does not do TypeScript type checking we can not
automatically remove type only imports and exports as this would require type
information. For this purpose TypeScript provides the
[`import type` and `export type` syntax](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-exports).
To export a type in a different file use
`export type { AnInterface } from "./mod.ts";`. To import a type use
`import type { AnInterface } from "./mod.ts";`. You can check that you are using
`import type` and `export type` where necessary by setting the `isolatedModules`
TypeScript compiler option to `true`, and the `importsNotUsedAsValues` to
`error`. You can see an example `tsconfig.json` with this option
[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`.
To make the most of skipping type checks, `--no-check` transpiles each module in
isolation without using information from imported modules. This maximizes
potential for concurrency and incremental rebuilds. On the other hand, the
transpiler cannot know if `export { Foo } from "./foo.ts"` should be preserved
(in case `Foo` is a value) or removed (in case `Foo` is strictly a type). To
resolve such ambiguities, Deno enforces
[`isolatedModules`](https://www.typescriptlang.org/tsconfig#isolatedModules) on
all TS code. This means that `Foo` in the above example must be a value, and the
[`export type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-exports)
syntax must be used instead if `Foo` is a type.
Because there is no type information when using `--no-check`, `const enum` is
not supported because it is type-directed. `--no-check` also does not support
the legacy `import =` and `export =` syntax.
Another consequence of `isolatedModules` is that the type-directed `const enum`
is treated like `enum`. The legacy `import =` and `export =` syntaxes are also
not supported by `--no-check`.
### Using external type definitions
@ -90,7 +87,7 @@ definition which happens to be alongside that file, your JavaScript module named
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
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

View file

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