github ts-safeql/safeql @ts-safeql/eslint-plugin@1.0.2

latest releases: @ts-safeql/generate@3.1.0, @ts-safeql/eslint-plugin@3.1.0, @ts-safeql/test-utils@0.0.16...
12 months ago

Patch Changes

  • d221910: ## Improved connections.overrides.types:

    Sometimes, the TypeScript type of the parameter (sql variable) is not the same as the type of the result. For example:

    import postgres from "postgres";
    import { sql } from "./sql";
    
    function run(value: postgres.Parameter<LocalDate>) {
      const result = sql<{ date: LocalDate }>`SELECT ${value}`;
      // ...
    }

    In this case, you can use the following syntax:

    {
      "connections": {
        "overrides": {
          "types": {
            "date": {
              // the type of the parameter (can be a glob pattern)
              "parameter": "Parameter<LocalDate>",
              // the generated type
              "return": "LocalDate"
            }
          }
        }
      }
    }

Don't miss a new safeql release

NewReleases is sending notifications on new releases.