Closed antoniel closed 11 months ago
Does setting it in the tsconfig of your tsoa's config file not work? See https://github.com/lukeautry/tsoa/blob/master/packages/runtime/src/config.ts#L41C14-L41C14
I am worried this might have unintended consequences when we run this on strict: false codebases and break typing completely. That said, maybe strict: true is by now common enough to test it.
Thank you for your suggestion! I did try setting it in the tsoa's config file, and it seems to work well. I agree that ensuring compatibility is essential. However, in scenarios where the OpenAPI file serves as a blueprint to generate validation schemas using tools like Zod, maintaining accurate type representation is critical. Having just string instead of string | null could lead to serious issues.
Maybe we can add explicitly in the documentation that setting the tsoa as strict in their config files is highly recommended, even if the tsconfig is not strict.
That would be highly appreciated.
Summary
This PR addresses issue #1474, aiming to improve the type inference mechanism for nullable union types in tsoa. By enabling TypeScript's strict mode, we significantly enhance the accuracy of type definitions and OpenAPI Schemas generated by the library.
Changes
compilerOptions
to includestrict: true
.Impact
How to Test
Context