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)andsql.values(rows): the fragment is checked against the target of theUPDATEorINSERTit is interpolated into, andsql.valuesalso 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'stransformInputcontext then hastable: null, soInputContext["table"]is nowstring | null.Replace
sql.emptywithsql.optional(value), whose argument is required: it returns the value, or forundefinedan omission that sendsDEFAULTinsql.param(), is skipped bysql.combine,sql.andandsql.or, and splices nothing when an optional fragment or query is interpolated as${…}.nullis returned as is and stays SQLNULL, as insql.set,sql.valuesandsql.json, and a fragment or query that can benullis a compile error. Writesql.optional(value ?? undefined)forsql.empty(value)andvalue ?? sql.empty,sql.optional(value)wherenullshould stayNULL, andsql.optional(undefined)for a baresql.empty. Addsql.if(value, then), which returns the fragment or querythen(value)builds whenvalueis truthy, withvaluenarrowed to its truthy type, and the same omission otherwise, as insql.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}insql(),sql.prepare(),sql.as()andsql.fragment(), and the statement is checked with the fragment spliced in, nested queries included.{name}slots and the slot-map argument are removed: replacesql("… {where}", { where }, ...params)withsql(`… ${where}`, ...params), andsql.prepare(text, slots)withsql.prepare(text); a{name}left in the SQL is now a syntax error. Fragment andQuerytypes are also string types, so a fragment or query passed as a parameter value, tosql.param()or tosql.id()throws.
Patch Changes
Reject comparisons PostgreSQL has no operator for, between numbers, strings, booleans, date/time values, intervals,
uuidandbyteaof different kinds, as inid = emailorid IN (SELECT title FROM posts):=,<>,<and the other comparison operators,IS DISTINCT FROM,INlists and subqueries,ANY/ALLsubqueries and row comparisons now giveoperator 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
LIMITorOFFSETparameter, as inlimit ${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 skipsORDER BYhandling when there is noORDER 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 rejectfirst_value,last_value,nth_value,lag,leadandany_valueof an untyped literal orNULL, as PostgreSQL does.Type as nullable a column that uses a cast parameter accepting
null, such asupper($1::text)orcoalesce($1::date); the aggregatesstddev,stddev_samp,variance,var_samp,corr,covar_samp,regr_intercept,regr_r2andregr_slope, which returnNULLfor a single row;to_charof a date, timestamp or interval; andcollation forof an untyped literal orNULL.Infer parameters in window
PARTITION BYandORDER BY, namedWINDOWclauses,DISTINCT ONand a query'sORDER BY, which were left untyped. They acceptnull, as inORDER 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 sendsDEFAULTlikesql.param(sql.empty)instead of SQLNULL(sql.json(null)still sendsNULL): inline, asql.json()value that can beundefinedis only accepted whereDEFAULTis; as a positional or named argument it is a compile error and throws; andsql.setandsql.valuesleave the column out, as they do forundefined.
Patch Changes
Check inline
sql.param()andsql.json()values, and values in fragments,sql.setandsql.values, against literal and object types: a value that does not fit aJson<T>column'sTor an enum, such assql.json({ theme: "blue" })for{ theme: "dark" | "light" }, is now an error that names the expected type, while a plainstring,numberorbooleanis still checked only for its kind.The README no longer links to the removed performance guide.
1.1.0
Minor Changes
- Add
sql.and([...])andsql.or([...]), which combine conditions withANDorORin parentheses, skipsql.emptyitems, givetrueorfalsewhen no condition is left, and keep the statement type-checked likesql.combine; editors no longer suggest" AND "and" OR "assql.combineseparators.
Patch Changes
@typesql/core,@typesql/pg,@typesql/postgres,@typesql/kysely,@typesql/drizzle,@typesql/prisma,@typesql/sqliteand@typesql/clinow 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'sz.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$ninside 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/sqliteand@typesql/clinow 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/sqliteand@typesql/clinow 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/sqliteand@typesql/clinow 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/sqliteand@typesql/clinow 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/sqliteand@typesql/clinow 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/sqliteand@typesql/clinow 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/sqliteand@typesql/clinow 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 fromsql(); interpolated${fragment}holes stay TypeScript, and completion treats a hole in aFROMclause as a relation.