dherault / serverless-offline

Emulate AWS λ and API Gateway locally when developing your Serverless project
MIT License
5.2k stars 794 forks source link

sls offline checks dependencies typings #777

Closed sebastiangug closed 5 years ago

sebastiangug commented 5 years ago

There doesn't seem to be a workaround for this and even though it mentions 'using local tsconfig.json' it does not respect the excludes/includes directories mentioned in that local tsconfig.

Therefore it will throw a bunch of errors due to typings of node_modules, currently in my case, due to jest and nestjs:


PATH/nestjs-serverless-demo/node_modules/@nestjs/core/application-config.d.ts (2,39): Cannot find module '@nestjs/common/interfaces/configuration-provider.interface'.
PATH/nestjs-serverless-demo/node_modules/@nestjs/core/nest-application.d.ts (40,9): A rest parameter must be of an array type.
PATH/nestjs-serverless-demo/node_modules/@nestjs/core/nest-application.d.ts (40,24): JSDoc types can only be used inside documentation comments.
PATH/nestjs-serverless-demo/node_modules/@types/jest/index.d.ts (39,31): A rest parameter must be of an array type.
PATH/nestjs-serverless-demo/node_modules/@types/jest/index.d.ts (124,54): A rest parameter must be of an array type.
PATH/nestjs-serverless-demo/node_modules/@types/jest/index.d.ts (218,113): A tuple type element list cannot be empty.
PATH/nestjs-serverless-demo/node_modules/@types/jest/index.d.ts (220,145): Type 'ArgsType<T[M]>' does not satisfy the constraint 'any[]'.
  Type '{}' is not assignable to type 'any[]'.
    Property 'length' is missing in type '{}'.
PATH/nestjs-serverless-demo/node_modules/@types/jest/index.d.ts (785,14): A rest parameter must be of an array type.
PATH/nestjs-serverless-demo/node_modules/@types/jest/index.d.ts (786,10): A rest parameter must be of an array type.
PATH/nestjs-serverless-demo/node_modules/@types/jest/index.d.ts (803,51): Type 'ArgsType<T[P]>' does not satisfy the constraint 'any[]'.
  Type '{}' is not assignable to type 'any[]'.
PATH/nestjs-serverless-demo/node_modules/@types/jest/index.d.ts (850,34): A rest parameter must be of an array type.
PATH/nestjs-serverless-demo/node_modules/@types/jest/index.d.ts (866,37): A rest parameter must be of an array type.
PATH/nestjs-serverless-demo/node_modules/@types/superagent/index.d.ts (16,1): Invalid 'reference' directive syntax.
dnalborczyk commented 5 years ago

hey @michaelbats

it's hard to see your intend. Is this a question or a bug report? either way, more information, or ideally a small repository outlining your problem would be very helpful.

sebastiangug commented 5 years ago

Ah sorry, here's the repo: https://github.com/theodo/nestjs-serverless-demo

It's a typescript project and trying to build the files is throwing out fatal errors due to type issues in underlying node_modules, in this case nestjs and jest being the major ones. These two being quite major/popular libraries/frameworks, is there a way to bypass this behaviour?

Versions:

λ serverless --version
1.49.0 (Enterprise Plugin: 1.3.8, Platform SDK: 2.1.0)

λ tsc --version
Version 3.5.2

λ nest --version
6.6.3

λ npm --version
6.4.1

λ node --version
v10.15.3

  "serverless-offline": "^3.31.3",
dnalborczyk commented 5 years ago

is this solving your issue? https://github.com/theodo/nestjs-serverless-demo/issues/1

dnalborczyk commented 5 years ago

@michaelbats feel free to re-open if you think this is a serverless-offline issue.