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
复制代码