Skip to content

Allow providing a config value to remove optional parameter generation #556

@pnappa

Description

@pnappa

Is your feature request related to a problem? Please describe.
It's fairly easy when refactoring nullable variables to miss somewhere that it's supposed to be changed. For non-nullable variables, there's a fairly reliable catch - as the variable is required to be provided to the query.run(params, conn) function, Typescript will raise an error.

However, if the variable is nullable, as of #482 nullable variables are now optional, so they do not raise an error if you provide a variable with the wrong name (typescript's excess property checking often does not catch these cases, never for me 😞).

Describe the solution you'd like
Provide a feature flag to the config file to remove the optional parameter type for nullable types. Something like noOptionalParameters: boolean.

I'm just testing if you'll like this feature, or if you'll want a different name for the flag. I can take responsibility for writing it, it's a very easy PR to make - prob <10 lines of code changes, and a few tests.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions