我最近将 deno 从 v1.3.0 更新到 v1.4.0。在更新之前,我的代码没有任何问题,但之后我有这个错误:
error: TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
LevelName,
~~~~~~~~~
at https://deno.land/x/branch@0.0.2/deps.ts:8:3
TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
export { LogConfig, setup, prefix } from "./branch.ts";
~~~~~~~~~
at https://deno.land/x/branch@0.0.2/mod.ts:3:10
TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { WatcherConfig } from "./watcher.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
at https://deno.land/x/denon@2.3.3/src/config.ts:14:1
TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { RunnerConfig } from "./runner.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
at https://deno.land/x/denon@2.3.3/src/config.ts:15:1
TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Args } from "./args.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
at https://deno.land/x/denon@2.3.3/src/config.ts:18:1
TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Template } from "./templates.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
at https://deno.land/x/denon@2.3.3/src/config.ts:19:1
TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Denon, DenonEvent } from "../denon.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
at https://deno.land/x/denon@2.3.3/src/daemon.ts:5:1
TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { CompleteDenonConfig } from "./config.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
at https://deno.land/x/denon@2.3.3/src/daemon.ts:6:1
TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { ScriptOptions } from "./scripts.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
at https://deno.land/x/denon@2.3.3/src/daemon.ts:7:1
Run Code Online (Sandbox Code Playgroud)
我找到了一个解决这个问题的页面,但这个错误看起来像是来自第三方库。我还使用天龙来运行脚本。这是我导入的包:
import { Application } from "https://deno.land/x/oak/mod.ts";
import { oakCors } from "https://deno.land/x/cors/mod.ts";
import { Router } from "https://deno.land/x/oak/mod.ts";
import { RouterContext } from "https://deno.land/x/oak/mod.ts";
import * as bcrypt from "https://deno.land/x/bcrypt/mod.ts";
import { SmtpClient } from "https://deno.land/x/smtp/mod.ts";
import { MongoClient } from "https://deno.land/x/mongo@v0.11.1/mod.ts";
Run Code Online (Sandbox Code Playgroud)
这是我的 denon.json:
{
"$schema": "https://deno.land/x/denon/schema.json",
"scripts": {
"start": {
"cmd": "deno run --unstable server.ts",
"allow": [
"net",
"write",
"read",
"plugin"
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
有没有办法来解决这个问题?或者降级 Deno 的方法?
小智 6
Deno v1.4.0 中添加了一个不稳定的特性。https://github.com/denoland/deno/pull/7413。这里有一个类似的问题https://github.com/Jozty/Fae/issues/32这将由库作者修复,或者您可以通过修复来提高 PR。临时修复是将 Deno 降级到 v1.3.0
小智 5
像这样设置 tsconfig 将解决问题
{
"compilerOptions": {
"importsNotUsedAsValues": "remove",
"isolatedModules": false,
}
}
Run Code Online (Sandbox Code Playgroud)
正如你所问的,如果你想降级,你可以这样做
带壳:
卷曲-fsSL https://deno.land/x/install/install.sh | sh -s v1.3.0
用勺子:
舀安装 deno@1.3.0
或者您可以在此处检查不同的环境。
| 归档时间: |
|
| 查看次数: |
2282 次 |
| 最近记录: |