lukeautry / tsoa

Build OpenAPI-compliant REST APIs using TypeScript and Node
MIT License
3.42k stars 489 forks source link

TypeScript error Object is possibly 'undefined' #1549

Closed montogeek closed 6 months ago

montogeek commented 6 months ago

When using an authenticationModule, and "strict": true in the TypeScript configuration, the compiled routes.ts throws a TypeScript error: Object is possibly 'undefined' on line 519:

image

By setting "strictNullChecks": false the error goes away.

Sorting

Expected Behavior

No errors in the routes.ts file.

Current Behavior

Object is possibly 'undefined'

Possible Solution

Steps to Reproduce

  1. Define an authenticationModule.
  2. Export an expressAuthentication function.
  3. Compile routes.ts file with tsoa spec-and-routes
  4. See TypeScript error when running the express app.

Context (Environment)

Version of the library: 6.0.1 Version of NodeJS: Node 20.10.0

Detailed Description

Breaking change?

github-actions[bot] commented 6 months ago

Hello there montogeek đź‘‹

Thank you for opening your very first issue in this project.

We will try to get back to you as soon as we can.đź‘€

montogeek commented 6 months ago

My bad, the expressAuthentication was returning undefined too, carry on!