我正在使用fastify 适配器
根据文档我已经安装了用于 fastify 的 swagger 适配器
npm install --save @nestjs/swagger fastify-swagger
当我导入 swagger 对象时
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
在构建应用程序阶段出现多个错误:
node_modules/@nestjs/swagger/dist/decorators/api-body.decorator.d.ts:4:35 - error TS2304: Cannot find name 'Omit'.
4 declare type RequestBodyOptions = Omit<RequestBodyObject, 'content'>;
~~~~
node_modules/@nestjs/swagger/dist/decorators/api-header.decorator.d.ts:3:43 - error TS2304: Cannot find name 'Omit'.
3 export interface ApiHeaderOptions extends Omit<ParameterObject, 'in'> {
~~~~
node_modules/@nestjs/swagger/dist/decorators/api-param.decorator.d.ts:4:33 - error TS2304: Cannot find name 'Omit'.
4 declare type ParameterOptions = Omit<ParameterObject, 'in' | 'schema'>;
~~~~
node_modules/@nestjs/swagger/dist/decorators/api-property.decorator.d.ts:2:45 - error …Run Code Online (Sandbox Code Playgroud) 我试图解决研究代码中的一个错误,但失败了。然后我只是尝试启动此代码...
https://github.com/nestjs/nest/tree/master/sample/23-type-graphql
和同样的情况...
错误看起来像
{
"errors": [
{
"message": "Cannot return null for non-nullable field Recipe.id.",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"recipe",
"id"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"stacktrace": [
"Error: Cannot return null for non-nullable field Recipe.id.",
" at completeValue (/home/innistry/Downloads/nest-master/sample/23-type-graphql/node_modules/graphql/execution/execute.js:560:13)",
" at /home/innistry/Downloads/nest-master/sample/23-type-graphql/node_modules/graphql/execution/execute.js:492:16",
" at process._tickCallback (internal/process/next_tick.js:68:7)"
]
}
}
}
],
"data": null
}
Run Code Online (Sandbox Code Playgroud)
有人有想法吗?