Skip to content

Changelog ​

What changed in each release, newest first, generated from each package's CHANGELOG.md. Breaking changes are listed under Major Changes. To move code across them, see Upgrading. Notes for releases before 1.0.0 are on the GitHub releases page.

@typesql/core, @typesql/pg, @typesql/postgres, @typesql/sqlite, @typesql/kysely, @typesql/drizzle, @typesql/prisma and @typesql/cli are released together at one version since 1.1.0; install them at the same version. The VS Code extension has its own version.

@typesql/core ​

3.0.0 ​

Major Changes ​

  • Leave the table out of sql.set(values) and sql.values(rows): the fragment is checked against the target of the UPDATE or INSERT it is interpolated into, and sql.values also checks the statement with only the keys every row always sends, so a required column a row can leave out is still an error. A plugin's transformInput context then has table: null, so InputContext["table"] is now string | null.

  • Replace sql.empty with sql.optional(value), whose argument is required: it returns the value, or for undefined an omission that sends DEFAULT in sql.param(), is skipped by sql.combine, sql.and and sql.or, and splices nothing when an optional fragment or query is interpolated as ${…}. null is returned as is and stays SQL NULL, as in sql.set, sql.values and sql.json, and a fragment or query that can be null is a compile error. Write sql.optional(value ?? undefined) for sql.empty(value) and value ?? sql.empty, sql.optional(value) where null should stay NULL, and sql.optional(undefined) for a bare sql.empty. Add sql.if(value, then), which returns the fragment or query then(value) builds when value is truthy, with value narrowed to its truthy type, and the same omission otherwise, as in sql.and([sql.if(search, (s) => sql.fragment(`"name" ILIKE ${sql.param(s)}`))]).

  • Interpolate fragments into the SQL template: every sql.* fragment (sql.fragment, sql.id, sql.combine, sql.and, sql.or, sql.set, sql.values, sql.raw) and a whole query can be written as ${fragment} in sql(), sql.prepare(), sql.as() and sql.fragment(), and the statement is checked with the fragment spliced in, nested queries included. {name} slots and the slot-map argument are removed: replace sql("… {where}", { where }, ...params) with sql(`… ${where}`, ...params), and sql.prepare(text, slots) with sql.prepare(text); a {name} left in the SQL is now a syntax error. Fragment and Query types are also string types, so a fragment or query passed as a parameter value, to sql.param() or to sql.id() throws.

Patch Changes ​

  • Reject comparisons PostgreSQL has no operator for, between numbers, strings, booleans, date/time values, intervals, uuid and bytea of different kinds, as in id = email or id IN (SELECT title FROM posts): =, <>, < and the other comparison operators, IS DISTINCT FROM, IN lists and subqueries, ANY/ALL subqueries and row comparisons now give operator does not exist: integer = text, as PostgreSQL does. Literals, parameters, enums, arrays and domains are still accepted.

  • Type statements with deeply nested subqueries that have a LIMIT or OFFSET parameter, as in limit ${sql.param(1)} three or more levels down, which failed with TS5115 "Instantiations … appear infinitely circular": parameter inference no longer nests the parameters found so far into each level, and skips ORDER BY handling when there is no ORDER BY.

  • Remove unused engine helpers and redundant internal exports.

  • Number the parameters right in the text, row and parameter types of a statement or fragment with several union fragments, such as two conditional pieces that each carry a value: the later piece's parameters were numbered as if every earlier piece were present and absent at once, while the statement itself was checked correctly.

2.0.1 ​

Patch Changes ​

  • Parse a parenthesized subquery used as an operand inside parentheses, as in ((SELECT 1) - 1), and reject first_value, last_value, nth_value, lag, lead and any_value of an untyped literal or NULL, as PostgreSQL does.

  • Type as nullable a column that uses a cast parameter accepting null, such as upper($1::text) or coalesce($1::date); the aggregates stddev, stddev_samp, variance, var_samp, corr, covar_samp, regr_intercept, regr_r2 and regr_slope, which return NULL for a single row; to_char of a date, timestamp or interval; and collation for of an untyped literal or NULL.

  • Infer parameters in window PARTITION BY and ORDER BY, named WINDOW clauses, DISTINCT ON and a query's ORDER BY, which were left untyped. They accept null, as in ORDER BY abs(extract(epoch from at - $1::timestamptz)), unless another use of the parameter rejects it.

2.0.0 ​

Major Changes ​

  • sql.json(undefined) now sends DEFAULT like sql.param(sql.empty) instead of SQL NULL (sql.json(null) still sends NULL): inline, a sql.json() value that can be undefined is only accepted where DEFAULT is; as a positional or named argument it is a compile error and throws; and sql.set and sql.values leave the column out, as they do for undefined.

Patch Changes ​

  • Check inline sql.param() and sql.json() values, and values in fragments, sql.set and sql.values, against literal and object types: a value that does not fit a Json<T> column's T or an enum, such as sql.json({ theme: "blue" }) for { theme: "dark" | "light" }, is now an error that names the expected type, while a plain string, number or boolean is still checked only for its kind.

  • The README no longer links to the removed performance guide.

1.1.0 ​

Minor Changes ​

  • Add sql.and([...]) and sql.or([...]), which combine conditions with AND or OR in parentheses, skip sql.empty items, give true or false when no condition is left, and keep the statement type-checked like sql.combine; editors no longer suggest " AND " and " OR " as sql.combine separators.

Patch Changes ​

  • @typesql/core, @typesql/pg, @typesql/postgres, @typesql/kysely, @typesql/drizzle, @typesql/prisma, @typesql/sqlite and @typesql/cli now share one version number and are released together: install them all at the same version.

1.0.1 ​

Patch Changes ​

  • Accept sql.json() over a recursive JSON type such as zod's z.core.util.JSONType, which failed with TS5115 ("Instantiations of the following types appear infinitely circular").

  • Copy a $ that is not followed by digits, as in the regex '[0-9]+$' or a $body$ dollar quote, through unchanged when a fragment is spliced into a query, and leave $n inside strings, quoted identifiers, comments and dollar quotes alone when counting and renumbering parameters, instead of failing with TS2589 or an "unterminated quoted string" error.

1.0.0 ​

Major Changes ​

  • Remove the Arr, Nullable, Generated and NullableGenerated schema helpers: write Col<"int4[]">, Col<"text", { nullable: true }>, Col<"int4", { hasDefault: true }> and Col<"text", { nullable: true; hasDefault: true }> instead.

Patch Changes ​

  • Update the README Playground examples to write columns with Col options instead of the removed Nullable and Generated helpers.

@typesql/pg ​

3.0.0 ​

Patch Changes ​

  • Stop exporting an internal view nullability helper.

  • Updated dependencies:

    • @typesql/core@3.0.0

2.0.1 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@2.0.1

2.0.0 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@2.0.0

1.1.0 ​

Patch Changes ​

  • @typesql/core, @typesql/pg, @typesql/postgres, @typesql/kysely, @typesql/drizzle, @typesql/prisma, @typesql/sqlite and @typesql/cli now share one version number and are released together: install them all at the same version.

  • Updated dependencies:

    • @typesql/core@1.1.0

@typesql/postgres ​

3.0.0 ​

Patch Changes ​

  • Remove the unused postgres development dependency; postgres stays a peer dependency.

  • Updated dependencies:

    • @typesql/core@3.0.0

2.0.1 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@2.0.1

2.0.0 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@2.0.0

1.1.0 ​

Patch Changes ​

  • @typesql/core, @typesql/pg, @typesql/postgres, @typesql/kysely, @typesql/drizzle, @typesql/prisma, @typesql/sqlite and @typesql/cli now share one version number and are released together: install them all at the same version.

  • Updated dependencies:

    • @typesql/core@1.1.0

@typesql/sqlite ​

3.0.0 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@3.0.0

2.0.1 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@2.0.1

2.0.0 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@2.0.0

1.1.0 ​

Patch Changes ​

  • @typesql/core, @typesql/pg, @typesql/postgres, @typesql/kysely, @typesql/drizzle, @typesql/prisma, @typesql/sqlite and @typesql/cli now share one version number and are released together: install them all at the same version.

  • Updated dependencies:

    • @typesql/core@1.1.0

@typesql/kysely ​

3.0.0 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@3.0.0

2.0.1 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@2.0.1

2.0.0 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@2.0.0

1.1.0 ​

Patch Changes ​

  • @typesql/core, @typesql/pg, @typesql/postgres, @typesql/kysely, @typesql/drizzle, @typesql/prisma, @typesql/sqlite and @typesql/cli now share one version number and are released together: install them all at the same version.

  • Updated dependencies:

    • @typesql/core@1.1.0

@typesql/drizzle ​

3.0.0 ​

Patch Changes ​

  • Stop exporting an internal casing type.

  • Updated dependencies:

    • @typesql/core@3.0.0

2.0.1 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@2.0.1

2.0.0 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@2.0.0

1.1.0 ​

Patch Changes ​

  • @typesql/core, @typesql/pg, @typesql/postgres, @typesql/kysely, @typesql/drizzle, @typesql/prisma, @typesql/sqlite and @typesql/cli now share one version number and are released together: install them all at the same version.

  • Updated dependencies:

    • @typesql/core@1.1.0

@typesql/prisma ​

3.0.0 ​

Patch Changes ​

  • Stop exporting internal generator helpers.

  • Updated dependencies:

    • @typesql/core@3.0.0

2.0.1 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@2.0.1

2.0.0 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@2.0.0

1.1.0 ​

Patch Changes ​

  • @typesql/core, @typesql/pg, @typesql/postgres, @typesql/kysely, @typesql/drizzle, @typesql/prisma, @typesql/sqlite and @typesql/cli now share one version number and are released together: install them all at the same version.

  • Updated dependencies:

    • @typesql/core@1.1.0

@typesql/cli ​

3.0.0 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@3.0.0
    • @typesql/pg@3.0.0
    • @typesql/sqlite@3.0.0

2.0.1 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@2.0.1
    • @typesql/pg@2.0.1
    • @typesql/sqlite@2.0.1

2.0.0 ​

Patch Changes ​

  • Updated dependencies:
    • @typesql/core@2.0.0
    • @typesql/pg@2.0.0
    • @typesql/sqlite@2.0.0

1.1.0 ​

Patch Changes ​

  • @typesql/core, @typesql/pg, @typesql/postgres, @typesql/kysely, @typesql/drizzle, @typesql/prisma, @typesql/sqlite and @typesql/cli now share one version number and are released together: install them all at the same version.

  • Updated dependencies:

    • @typesql/core@1.1.0
    • @typesql/pg@1.1.0
    • @typesql/sqlite@1.1.0

VS Code extension (typesql) ​

1.0.0 ​

Major Changes ​

  • Stop coloring {name} as a fragment slot, since {name} slots were removed from sql(); interpolated ${fragment} holes stay TypeScript, and completion treats a hole in a FROM clause as a relation.