Skip to content

feat: use strict typescript settings#131

Merged
mnahkies merged 5 commits into
mainfrom
mn/fix/strict-typescript
Mar 2, 2024
Merged

feat: use strict typescript settings#131
mnahkies merged 5 commits into
mainfrom
mn/fix/strict-typescript

Conversation

@mnahkies

@mnahkies mnahkies commented Mar 2, 2024

Copy link
Copy Markdown
Owner

Adopt "strictest" typescript base settings, and adjust code generation to support this

  • Fix various typescript errors that popped up
  • Avoiding passing timeout key when no timeout passed for axios to be compatible with exactOptionalPropertyTypes
  • Attempt to read and parse the tsconfig.json for specified output directory
  • For typescript-koa include | undefined on optional properties when exactOptionalPropertyTypes is configured
    • This shouldn't be required for the clients, as in this case the consumer can choose to omit keys
      • Though maybe it's more ergonomic to follow this behavior anyway?
  • Not dealt with stripping unused imports so far

@mnahkies
mnahkies force-pushed the mn/fix/strict-typescript branch from 8eb8528 to 5e88b0a Compare March 2, 2024 10:45
@mnahkies
mnahkies marked this pull request as ready for review March 2, 2024 14:03
@mnahkies
mnahkies merged commit 39758e2 into main Mar 2, 2024
@mnahkies
mnahkies deleted the mn/fix/strict-typescript branch March 2, 2024 14:03
mnahkies added a commit that referenced this pull request Dec 8, 2024
previously we were always treating it as `false`, rather than using the
value we read from the `tsconfig.json` file. this was intentional at the
time in #131
> - For `typescript-koa` include `| undefined` on optional properties
when `exactOptionalPropertyTypes` is configured
> - This shouldn't be required for the clients, as in this case the
consumer can choose to omit keys
>     - Though maybe it's more ergonomic to follow this behavior anyway?

However it turns out this can cause issues with the `zod` schemas when
runtime validation is enabled, and so it's better to follow this `|
undefined` pattern on the clients as well. It's probably more ergonomic
as well tbh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant