Skip to content

handler return type inferred as 'any' #30

@universalhandle

Description

@universalhandle

This might be a regression from one of the two minor releases this week. I'm pretty sure this was working before I upgraded. See update in follow-up comment.

Today I noticed my linter complaining about:

const app: Application
Unsafe assignment of an any value.eslint(@typescript-eslint/no-unsafe-assignment)

...for code like:

import handler from '@curveball/aws-lambda';
// ...
export const router = handler(app);

I believe this is due at least in part to node_modules/@curveball/aws-lambda/dist/index.d.ts exporting an interface directly from @types/aws-lambda. The file contents are:

import { Application } from '@curveball/core';
import { APIGatewayProxyHandler } from 'aws-lambda';
export default function lambdaHandler(app: Application): APIGatewayProxyHandler;

My IDE shows an error for aws-lambda on line 2: Cannot find module 'aws-lambda' or its corresponding type declarations.

Per the manual, a package that exports another package's types should declare the latter as a dependency in package.json rather than devDependency.

I'm not sure if I'm failing to build the dist correctly or what, but making this change alone does not seem to correct the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions