Deno 能夠直接運行 TypeScript 的 TS 文件,在咱們學習 TypeScript 的時候能夠使用 Deno 做用運行時。node
Deno 官方出了 vscode 插件,來幫咱們更好的使用 deno。可是有點就是,deno 項目和node 項目打開的時候,deno會進行檢查,提出提示。目前仍是以node爲主,deno爲輔,將Deno插件禁用,僅僅在須要的項目裏打開。react
{
"compilerOptions": {
"allowJs": false,
"allowUmdGlobalAccess": false,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"alwaysStrict": true,
"assumeChangesOnlyAffectDirectDependencies": false,
"checkJs": false,
"disableSizeLimit": false,
"generateCpuProfile": "profile.cpuprofile",
"jsx": "react",
"jsxFactory": "React.createElement",
"lib": [],
"noFallthroughCasesInSwitch": false,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitUseStrict": false,
"noStrictGenericChecks": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveConstEnums": false,
"removeComments": false,
"resolveJsonModule": true,
"strict": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"suppressExcessPropertyErrors": false,
"suppressImplicitAnyIndexErrors": false,
"useDefineForClassFields": false
}
}
複製代碼
咱們看到並無將裝飾器包含在裏面,當咱們須要裝飾器的支持的時候,自定一個 tsconfig.json
而後使用,將配置隨命令行一塊兒使用:json
# --config
deno run --config ./tsconfig.json ./src/main.ts
# -c 簡短的寫法
deno run --config ./tsconfig.json ./src/index.ts
複製代碼