nanogiants/nestjs-swagger-api-exception-decorator

cannot run demo

schiller-manuel opened this issue · 0 comments

I tried to run the demo project to reproduce an issue that I have in my codebase, but it fails to run.

I executed the following commands:

git clone git@github.com:nanogiants/nestjs-swagger-api-exception-decorator.git
cd nestjs-swagger-api-exception-decorator
npm install
npm run prepublishOnly
cd demo
npm install
npm run build

This gives the following output:

> nestjs-swagger-api-exception-decorator-demo@0.0.1 prebuild
> rimraf dist


> nestjs-swagger-api-exception-decorator-demo@0.0.1 build
> nest build

src/app.controller.ts:49:15 - error TS2322: Type 'typeof BaseException' is not assignable to type 'Type<HttpException>'.
  Type 'BaseException' is not assignable to type 'HttpException'.
    Types have separate declarations of a private property 'response'.

49         () => BaseException,
                 ~~~~~~~~~~~~~

  ../dist/lib/builder/placeholder.builder.d.ts:9:77
    9 export declare const buildPlaceholder: <T extends HttpException>(exception: () => Type<T>, resolver: (exception: T) => any) => Placeholder;
                                                                                  ~~~~~~~~~~~~~
    The expected type comes from the return type of this signature.
src/app.controller.ts:50:34 - error TS2339: Property 'getClientCode' does not exist on type 'HttpException'.

50         (exception) => exception.getClientCode(),
                                    ~~~~~~~~~~~~~
src/app.controller.ts:57:21 - error TS2322: Type 'typeof UnauthorizedException' is not assignable to type 'Exception<HttpException> | Exception<HttpException>[]'.
  Type 'typeof UnauthorizedException' is not assignable to type 'Type<HttpException>'.
    Type 'UnauthorizedException' is not assignable to type 'HttpException'.
      Types have separate declarations of a private property 'response'.

57 @ApiException(() => UnauthorizedException, {
                       ~~~~~~~~~~~~~~~~~~~~~

  ../dist/lib/interfaces/api-exception.interface.d.ts:3:70
    3 export type ExceptionOrExceptionArrayFunc<T extends HttpException> = () => Exception<T> | Exception<T>[];
                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from the return type of this signature.
src/app.controller.ts:66:24 - error TS2322: Type 'typeof MissingPropertyException' is not assignable to type 'Exception<HttpException>'.
  Type 'typeof MissingPropertyException' is not assignable to type 'Type<HttpException>'.
    Type 'MissingPropertyException' is not assignable to type 'HttpException'.
      Types have separate declarations of a private property 'response'.

66   @ApiException(() => [MissingPropertyException, PayloadMissingException])
                          ~~~~~~~~~~~~~~~~~~~~~~~~
src/app.controller.ts:66:50 - error TS2322: Type 'typeof PayloadMissingException' is not assignable to type 'Exception<HttpException>'.
  Type 'typeof PayloadMissingException' is not assignable to type 'Type<HttpException>'.
    Type 'PayloadMissingException' is not assignable to type 'HttpException'.
      Types have separate declarations of a private property 'response'.

66   @ApiException(() => [MissingPropertyException, PayloadMissingException])
                                                    ~~~~~~~~~~~~~~~~~~~~~~~
src/app.controller.ts:75:24 - error TS2322: Type 'typeof NotFoundException' is not assignable to type 'Exception<HttpException>'.
  Type 'typeof NotFoundException' is not assignable to type 'Type<HttpException>'.
    Type 'NotFoundException' is not assignable to type 'HttpException'.
      Types have separate declarations of a private property 'response'.

75   @ApiException(() => [NotFoundException, BadRequestException], {
                          ~~~~~~~~~~~~~~~~~
src/app.controller.ts:75:43 - error TS2322: Type 'typeof BadRequestException' is not assignable to type 'Exception<HttpException>'.
  Type 'typeof BadRequestException' is not assignable to type 'Type<HttpException>'.
    Type 'BadRequestException' is not assignable to type 'HttpException'.
      Types have separate declarations of a private property 'response'.

75   @ApiException(() => [NotFoundException, BadRequestException], {
                                             ~~~~~~~~~~~~~~~~~~~
src/app.controller.ts:78:23 - error TS2322: Type 'typeof NotFoundException' is not assignable to type 'Exception<HttpException> | Exception<HttpException>[]'.
  Type 'typeof NotFoundException' is not assignable to type 'Type<HttpException>'.

78   @ApiException(() => NotFoundException, {
                         ~~~~~~~~~~~~~~~~~

  ../dist/lib/interfaces/api-exception.interface.d.ts:3:70
    3 export type ExceptionOrExceptionArrayFunc<T extends HttpException> = () => Exception<T> | Exception<T>[];
                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from the return type of this signature.
src/app.controller.ts:87:23 - error TS2322: Type 'typeof BadRequestException' is not assignable to type 'Exception<HttpException> | Exception<HttpException>[]'.
  Type 'typeof BadRequestException' is not assignable to type 'Type<HttpException>'.

87   @ApiException(() => BadRequestException, {
                         ~~~~~~~~~~~~~~~~~~~

  ../dist/lib/interfaces/api-exception.interface.d.ts:3:70
    3 export type ExceptionOrExceptionArrayFunc<T extends HttpException> = () => Exception<T> | Exception<T>[];
                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from the return type of this signature.
src/app.controller.ts:90:23 - error TS2322: Type 'typeof NotFoundException' is not assignable to type 'Exception<HttpException> | Exception<HttpException>[]'.

90   @ApiException(() => NotFoundException, { type: () => SwaggerAnnotations })
                         ~~~~~~~~~~~~~~~~~

  ../dist/lib/interfaces/api-exception.interface.d.ts:3:70
    3 export type ExceptionOrExceptionArrayFunc<T extends HttpException> = () => Exception<T> | Exception<T>[];
                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from the return type of this signature.
src/app.controller.ts:91:23 - error TS2322: Type 'typeof UnauthorizedException' is not assignable to type 'Exception<HttpException> | Exception<HttpException>[]'.

91   @ApiException(() => UnauthorizedException, {
                         ~~~~~~~~~~~~~~~~~~~~~

  ../dist/lib/interfaces/api-exception.interface.d.ts:3:70
    3 export type ExceptionOrExceptionArrayFunc<T extends HttpException> = () => Exception<T> | Exception<T>[];
                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from the return type of this signature.
src/app.controller.ts:94:23 - error TS2322: Type 'typeof ConflictException' is not assignable to type 'Exception<HttpException> | Exception<HttpException>[]'.
  Type 'typeof ConflictException' is not assignable to type 'Type<HttpException>'.
    Type 'ConflictException' is not assignable to type 'HttpException'.
      Types have separate declarations of a private property 'response'.

94   @ApiException(() => ConflictException, { type: () => SwaggerAnnotations })
                         ~~~~~~~~~~~~~~~~~

  ../dist/lib/interfaces/api-exception.interface.d.ts:3:70
    3 export type ExceptionOrExceptionArrayFunc<T extends HttpException> = () => Exception<T> | Exception<T>[];
                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from the return type of this signature.
src/app.controller.ts:101:23 - error TS2322: Type 'typeof BadRequestException' is not assignable to type 'Exception<HttpException> | Exception<HttpException>[]'.

101   @ApiException(() => BadRequestException, {
                          ~~~~~~~~~~~~~~~~~~~

  ../dist/lib/interfaces/api-exception.interface.d.ts:3:70
    3 export type ExceptionOrExceptionArrayFunc<T extends HttpException> = () => Exception<T> | Exception<T>[];
                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from the return type of this signature.
src/app.controller.ts:111:23 - error TS2322: Type 'typeof BadRequestException' is not assignable to type 'Exception<HttpException> | Exception<HttpException>[]'.

111   @ApiException(() => BadRequestException, {
                          ~~~~~~~~~~~~~~~~~~~

  ../dist/lib/interfaces/api-exception.interface.d.ts:3:70
    3 export type ExceptionOrExceptionArrayFunc<T extends HttpException> = () => Exception<T> | Exception<T>[];
                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from the return type of this signature.
src/app.controller.ts:120:23 - error TS2322: Type 'typeof BadRequestException' is not assignable to type 'Exception<HttpException> | Exception<HttpException>[]'.

120   @ApiException(() => BadRequestException, {
                          ~~~~~~~~~~~~~~~~~~~

  ../dist/lib/interfaces/api-exception.interface.d.ts:3:70
    3 export type ExceptionOrExceptionArrayFunc<T extends HttpException> = () => Exception<T> | Exception<T>[];
                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from the return type of this signature.
src/app.controller.ts:139:5 - error TS2322: Type 'typeof MissingPropertyException' is not assignable to type 'Exception<HttpException>'.

139     MissingPropertyException,
        ~~~~~~~~~~~~~~~~~~~~~~~~
src/app.controller.ts:140:5 - error TS2322: Type 'typeof PayloadMissingException' is not assignable to type 'Exception<HttpException>'.

140     PayloadMissingException,
        ~~~~~~~~~~~~~~~~~~~~~~~
src/app.controller.ts:141:5 - error TS2322: Type 'typeof CustomNotFoundException' is not assignable to type 'Exception<HttpException>'.
  Type 'typeof CustomNotFoundException' is not assignable to type 'Type<HttpException>'.
    Type 'CustomNotFoundException' is not assignable to type 'HttpException'.
      Types have separate declarations of a private property 'response'.

141     CustomNotFoundException,
        ~~~~~~~~~~~~~~~~~~~~~~~
src/app.controller.ts:142:5 - error TS2322: Type 'typeof UserUnauthorizedException' is not assignable to type 'Exception<HttpException>'.
  Type 'typeof UserUnauthorizedException' is not assignable to type 'Type<HttpException>'.
    Type 'UserUnauthorizedException' is not assignable to type 'HttpException'.
      Types have separate declarations of a private property 'response'.

142     UserUnauthorizedException,
        ~~~~~~~~~~~~~~~~~~~~~~~~~
src/app.controller.ts:152:23 - error TS2322: Type 'typeof BadRequestException' is not assignable to type 'Exception<HttpException> | Exception<HttpException>[]'.

152   @ApiException(() => BadRequestException, {
                          ~~~~~~~~~~~~~~~~~~~

  ../dist/lib/interfaces/api-exception.interface.d.ts:3:70
    3 export type ExceptionOrExceptionArrayFunc<T extends HttpException> = () => Exception<T> | Exception<T>[];
                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from the return type of this signature.
src/app.controller.ts:174:24 - error TS2322: Type 'typeof EmailResponseFailedException' is not assignable to type 'Exception<HttpException>'.
  Type 'typeof EmailResponseFailedException' is not assignable to type 'Type<HttpException>'.
    Type 'EmailResponseFailedException' is not assignable to type 'HttpException'.
      Types have separate declarations of a private property 'response'.

174   @ApiException(() => [EmailResponseFailedException, InternalServerException])
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app.controller.ts:174:54 - error TS2322: Type 'typeof InternalServerException' is not assignable to type 'Exception<HttpException>'.
  Type 'typeof InternalServerException' is not assignable to type 'Type<HttpException>'.
    Type 'InternalServerException' is not assignable to type 'HttpException'.
      Types have separate declarations of a private property 'response'.

174   @ApiException(() => [EmailResponseFailedException, InternalServerException])
                                                         ~~~~~~~~~~~~~~~~~~~~~~~

Found 22 error(s).