首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NestJS在构建应用程序时强调夸张错误

NestJS在构建应用程序时强调夸张错误
EN

Stack Overflow用户
提问于 2019-12-14 19:30:18
回答 1查看 2.5K关注 0票数 1

我正在使用fastify adapter

根据the documentation的说法,我已经为fastify安装了swagger适配器

npm install --save @nestjs/swagger fastify-swagger

当我导入swagger对象时

import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';

在构建应用程序阶段获取多个错误:

代码语言:javascript
复制
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 TS2304: Cannot find name 'Omit'.

2 export interface ApiPropertyOptions extends Omit<SchemaObjectMetadata, 'name' | 'enum'> {
                                              ~~~~

node_modules/@nestjs/swagger/dist/decorators/api-property.decorator.d.ts:8:80 - error TS2344: Type '"type" | "enum" | "example" | "format" | "deprecated"' does not satisfy the constraint '"name" | "enum"'.
  Type '"type"' is not assignable to type '"name" | "enum"'.

8 export declare function ApiResponseProperty(options?: Pick<ApiPropertyOptions, 'type' | 'example' | 'format' | 'enum' | 'deprecated'>): PropertyDecorator;
                                                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@nestjs/swagger/dist/decorators/api-query.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-response.decorator.d.ts:3:46 - error TS2304: Cannot find name 'Omit'.

3 export interface ApiResponseMetadata extends Omit<ResponseObject, 'description'> {
                                               ~~~~

node_modules/@nestjs/swagger/dist/decorators/api-response.decorator.d.ts:9:48 - error TS2304: Cannot find name 'Omit'.

9 export interface ApiResponseSchemaHost extends Omit<ResponseObject, 'description'> {
                                                 ~~~~

node_modules/@nestjs/swagger/dist/document-builder.d.ts:20:14 - error TS2304: Cannot find name 'Omit'.

20     build(): Omit<OpenAPIObject, 'components' | 'paths'>;
                ~~~~

node_modules/@nestjs/swagger/dist/interfaces/schema-object-metadata.interface.d.ts:3:47 - error TS2304: Cannot find name 'Omit'.
                                                           ~~~~

有没有人知道该怎么做?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-12-14 21:58:35

好了,我找到答案了。

打开文件tsconfig.json并添加以下行:

代码语言:javascript
复制
{
    compilerOptions: {
        "skipLibCheck": true
    }
}

我不确定这是不是最好的方法,因为它会在编译时跳过你的node_modules检查。但要启动它,它是有帮助的。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59334710

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档