Skip to main content

Migration

Breaking renames and behaviour changes when upgrading duck-ttest.

This page mirrors packages/duck-ttest/MIGRATION.md. Follow it before bumping the dependency.

Subpath renames

A pass of canonicalization removed three duplicated/typo'd sub-paths. Update your imports.

Old subpathNew subpathNotes
@gentleduck/ttest/predictates@gentleduck/ttest/predicatesTypo fix.
@gentleduck/ttest/domain@gentleduck/ttest/json + @gentleduck/ttest/formatSplit. JSONValue etc. live in json; structural format strings live in format.
@gentleduck/ttest/objects@gentleduck/ttest/objectSingular is canonical.

Find-and-replace:

# In your project
rg -l '@gentleduck/ttest/predictates' | xargs sed -i 's|/predictates|/predicates|g'
rg -l '@gentleduck/ttest/objects'     | xargs sed -i 's|/objects|/object|g'
# 'domain' splits — review each import by hand and route to /json or /format.

Type renames

Old nameNew nameReason
NegativeNumber (from ~/number)NegativeSymmetric with peer NonNegative.
IsOptional (from ~/sql)IsSQLOptionalAvoid semantic collision with ~/primitive's IsOptional.
IsNullable (from ~/sql)IsSQLNullableAvoid semantic collision with ~/primitive's IsNullable.

The TS-level IsOptional and IsNullable (from @gentleduck/ttest/primitive) check whether undefined or null is part of a TS type. The SQL-level helpers check column-constraint strings inside DDL parsing. They are not interchangeable.

// Before
import type { IsOptional as IsSqlOpt } from '@gentleduck/ttest/sql'

// After
import type { IsSQLOptional } from '@gentleduck/ttest/sql'

Behavior change: SQLTypeMap['JSON']

SymbolBeforeAfter
SQLTypeMap['JSON']anyJSONValue (imported from ~/json)

If you relied on the any widening, narrow your value to JSONValue (a recursive string \| number \| boolean \| null \| JSONObject \| JSONArray) or cast at the boundary:

import type { JSONValue } from '@gentleduck/ttest/json'

const row = await db.fetchRow() as { settings: JSONValue }
//                                              ^ was `any` in v0.x

Back-compat re-exports (deprecated)

These symbols still re-export from ~/sql with @deprecated JSDoc. They will be removed in a future major.

  • Trim — canonical home is @gentleduck/ttest/template.
  • UnionToIntersection — canonical home is @gentleduck/ttest/union.
// Before
import type { Trim, UnionToIntersection } from '@gentleduck/ttest/sql'

// After
import type { Trim } from '@gentleduck/ttest/template'
import type { UnionToIntersection } from '@gentleduck/ttest/union'

If you build duck-ttest locally

The renamed folders (predicates/, json/, format/, object/) won't overwrite stale predictates/, domain/, objects/ in dist/. Delete dist/ before rebuilding:

cd packages/duck-ttest
rm -rf dist
bun run build

The npm tarball only ships src/, so registry consumers are unaffected — this only matters when iterating on duck-ttest itself.

Checklist

  • [ ] All /predictates/predicates.
  • [ ] All /objects/object.
  • [ ] All /domain imports split into /json or /format.
  • [ ] NegativeNumberNegative.
  • [ ] IsOptional from ~/sqlIsSQLOptional.
  • [ ] IsNullable from ~/sqlIsSQLNullable.
  • [ ] Trim / UnionToIntersection imports moved off ~/sql.
  • [ ] Any SQLTypeMap['JSON'] usage typed against JSONValue instead of any.