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

latest releases: @ts-safeql/test-utils@0.0.30, @ts-safeql/shared@3.4.7, @ts-safeql/generate@3.4.7...
18 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.