【发布时间】:2021-10-03 14:08:06
【问题描述】:
我目前正在学习 TypeGraphQL 并尝试创建一个基本的 reslover,我的代码如下所示:
@Resolver()
class HelloReslover {
@Query(() => String)
async hello(){
return "hello wtold"
}
}
但我得到了这个错误:
“对装饰器的实验性支持是一项受制于 在将来的版本中更改。设置 'experimentalDecorators' 选项 你的 'tsconfig' 或 'jsconfig' 来删除这个警告。”
但我的tsconfig 文件看起来像这样:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"lib": ["dom", "es6", "es2017", "esnext.asynciterable"],
"sourceMap": true,
"outDir": "./dist",
"moduleResolution": "node",
"declaration": false,
"composite": false,
"removeComments": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"baseUrl": ".",
"rootDir": "src"
},
"exclude": ["node_modules"],
"include": ["./src/**/*.tsx", "./src/**/*.ts"]
}
我该如何解决这个问题?
【问题讨论】:
-
奇怪,能分享一下代码吗?
-
我自己修好了,如果有人遇到同样的问题,我会分享如何
标签: node.js typescript graphql typegraphql