Skip to content

Published package should embed necessary type declarations #10

@MarioArnt

Description

@MarioArnt

Just tried to install node-serverless-helpers in a new project.

Got this message when compiling my project:


node_modules/node-serverless-helpers/dist/handling/api/api.d.ts:1:61 - error TS7016: Could not find a declaration file for module 'aws-lambda'. '/Users/marioarnautou/Code/OpenSource/µlambda/example/services/service-1/node_modules/aws-lambda/lib/main.js' implicitly has an 'any' type.
  Try `npm install @types/aws-lambda` if it exists or add a new declaration (.d.ts) file containing `declare module 'aws-lambda';`

1 import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
                                                              ~~~~~~~~~~~~

node_modules/node-serverless-helpers/dist/handling/api/api.d.ts:3:63 - error TS7016: Could not find a declaration file for module 'aws-lambda'. '/Users/marioarnautou/Code/OpenSource/µlambda/example/services/service-1/node_modules/aws-lambda/lib/main.js' implicitly has an 'any' type.
  Try `npm install @types/aws-lambda` if it exists or add a new declaration (.d.ts) file containing `declare module 'aws-lambda';`

3 export declare const apiHandler: (next: ApiHandler) => import("aws-lambda").Handler<APIGatewayProxyEvent, APIGatewayProxyResult>;
                                                                ~~~~~~~~~~~~

node_modules/node-serverless-helpers/dist/handling/api/types.d.ts:2:70 - error TS7016: Could not find a declaration file for module 'aws-lambda'. '/Users/marioarnautou/Code/OpenSource/µlambda/example/services/service-1/node_modules/aws-lambda/lib/main.js' implicitly has an 'any' type.
  Try `npm install @types/aws-lambda` if it exists or add a new declaration (.d.ts) file containing `declare module 'aws-lambda';`

2 import { APIGatewayProxyEvent, APIGatewayProxyResult, Context } from 'aws-lambda';
                                                                       ~~~~~~~~~~~~

node_modules/node-serverless-helpers/dist/handling/index.d.ts:1:25 - error TS7016: Could not find a declaration file for module 'aws-lambda'. '/Users/marioarnautou/Code/OpenSource/µlambda/example/services/service-1/node_modules/aws-lambda/lib/main.js' implicitly has an 'any' type.
  Try `npm install @types/aws-lambda` if it exists or add a new declaration (.d.ts) file containing `declare module 'aws-lambda';`

1 import { Handler } from 'aws-lambda';
                          ~~~~~~~~~~~~

node_modules/node-serverless-helpers/dist/validation/validate.d.ts:1:28 - error TS7016: Could not find a declaration file for module 'joi'. '/Users/marioarnautou/Code/OpenSource/µlambda/example/services/service-1/node_modules/joi/lib/index.js' implicitly has an 'any' type.
  Try `npm install @types/joi` if it exists or add a new declaration (.d.ts) file containing `declare module 'joi';`

1 import { SchemaLike } from 'joi';
                             ~~~~~


Found 5 errors.

Fixed that by addding @types/aws-lambda and @types/joi as project devDeps.

Yet, IMO it should be not necessary to do that and these typings packages should be installed automatically when installing node-serverless-helpers.

So we should declare them either as direct dependencies, either as peer dependencies in node-serverless-helpers package.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions