嘗試運行我的 deno 應用程式時出現以下錯誤,我不明白為什么.. 有人遇到過這個問題嗎?
運行命令:deno run --allow-all server.ts
錯誤:
error: TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
RouterContext,
~~~~~~~~~~~~~
at file:///Users/XXXX/Documents/DenoAPP/deps.ts:4:3
部門.ts
export { Application, Router, RouterContext, Context, send } from "https://deno.land/x/[email protected]/mod.ts";
export { MongoClient } from "https://deno.land/x/[email protected]/mod.ts";
export { hashSync, compareSync} from "https://deno.land/x/[email protected]/mod.ts";
import "https://deno.land/x/[email protected]/load.ts";
export * from "https://deno.land/x/[email protected]/mod.ts";
uj5u.com熱心網友回復:
有關說明,請參見--isolatedModules。
他們自己檢查OAK RouterContextexport type。
所以順其自然,分道揚鑣
export { Application, Router, RouterContext, Context, send } from "https://deno.land/x/[email protected]/mod.ts";
進入
export { Application, Router, send } from "https://deno.land/x/[email protected]/mod.ts";
export type { RouterContext, Context } from "https://deno.land/x/[email protected]/mod.ts";
uj5u.com熱心網友回復:
您可以type在型別名稱上使用修飾符來解決您的問題。這是 TS 版本 ≥ 的慣用和推薦方法4.5:
export {
Application,
Router,
type RouterContext,
Context,
send,
} from "https://deno.land/x/[email protected]/mod.ts";
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/442533.html
下一篇:我如何設定屬性的值
