10000 TypeScript unable to infer types · Issue #1223 · middyjs/middy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
TypeScript unable to infer types #1223
Closed
@canassa

Description

@canassa

Describe the bug

I’m trying to implement this example from the Middy documentation. I copied it exactly into my project, but when I run it, TypeScript is unable to determine the types of event and context. I believe this example originated from a comment by @bilalq, maybe he knows how to get this to work?

src/functions/health/get.ts:32:21 - error TS7006: Parameter 'event' implicitly has an 'any' type.

32     .handler(async (event, context) => {
                       ~~~~~

src/functions/health/get.ts:32:28 - error TS7006: Parameter 'context' implicitly has an 'any' type.

32     .handler(async (event, context) => {
                              ~~~~~~~

My TS config:

{
  "include": ["src/**/*.ts", "*.ts"],
  "compilerOptions": {
    "allowJs": true,
    "checkJs": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "forceConsistentCasingInFileNames": true,
    "importHelpers": true,
    "module": "node16",
    "moduleResolution": "node16",
    "noEmit": true,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "sourceMap": true,
    "strict": true,
    "target": "es2022",
    "verbatimModuleSyntax": true
  }
}

Environment:

  • Node.js: 20
  • Middy: 5.4.3
  • TypeScript: 5.5.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0