Skip to content

chore: update TypeScript to 6.0.3#44

Merged
wellwelwel merged 1 commit into
mysqljs:mainfrom
pdeveltere:chore/typescript-6
Jul 12, 2026
Merged

chore: update TypeScript to 6.0.3#44
wellwelwel merged 1 commit into
mysqljs:mainfrom
pdeveltere:chore/typescript-6

Conversation

@pdeveltere

Copy link
Copy Markdown
Contributor

Why

TypeScript 6.0 ships lib types for Temporal (the esnext.temporal lib), which lets sql-escaper type Temporal values natively rather than structurally — see the release note: New Types for Temporal. This bump is a prerequisite for that (discussed in #43 / #42).

Changes

Just the compiler bump plus three behavior-preserving tsconfig adjustments that TS 6 now enforces:

  • ignoreDeprecations: "6.0"moduleResolution=node10, esModuleInterop=false and allowSyntheticDefaultImports=false are deprecated in 6.0 (they stop functioning in 7.0). Kept as-is here so this PR does not change module-resolution behavior; migrating them is a separate TS 7 concern.
  • rootDir: "src" — now required (TS5011) to preserve the existing lib/ output layout.
  • types: ["node"] — under node10 resolution TS 6 no longer auto-includes @types/node, so Buffer / node:* imports need it declared explicitly.

Verification

tsc, npm run build, npm run test:node and npm run lint all pass.

TypeScript 6.0 ships lib types for Temporal (esnext.temporal), which lets
sql-escaper type Temporal values natively instead of structurally. See
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-6-0.html#new-types-for-temporal

The bump requires three behavior-preserving tsconfig adjustments that TS 6 now
enforces:

- ignoreDeprecations: "6.0" — moduleResolution=node10, esModuleInterop=false and
  allowSyntheticDefaultImports=false are deprecated in 6.0 (removed in 7.0); kept
  as-is to avoid a module-resolution behavior change in this PR.
- rootDir: "src" — now required (TS5011) to keep the existing lib/ output layout.
- types: ["node"] — TS 6 no longer auto-resolves @types/node under node10
  resolution, so Buffer/node:* imports need it declared explicitly.

Build, tests and lint all pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (bda3792) to head (d864f1d).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #44   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          548       548           
=========================================
  Hits           548       548           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wellwelwel wellwelwel changed the title Update TypeScript to 6.0.3 chore: update TypeScript to 6.0.3 Jul 12, 2026
@wellwelwel

Copy link
Copy Markdown
Member

Thanks, @pdeveltere 🙋🏻‍♂️

@wellwelwel
wellwelwel merged commit 58a69f1 into mysqljs:main Jul 12, 2026
11 checks passed
@pdeveltere
pdeveltere deleted the chore/typescript-6 branch July 12, 2026 09:52
pdeveltere added a commit to pdeveltere/sql-escaper that referenced this pull request Jul 12, 2026
- type Temporal values via the esnext.temporal lib (unblocked by mysqljs#44)
  instead of the structural TemporalLike shape
- add tests for the ISO-string fallback (Duration, PlainYearMonth,
  PlainMonthDay)
- run Temporal tests on every runtime via @js-temporal/polyfill (dev-only)
  so coverage no longer depends on the CI Node version
- trim comments to decision notes per review
wellwelwel added a commit that referenced this pull request Jul 12, 2026
* Add Temporal support to escape

Escaping a Temporal value (e.g. Temporal.Instant) currently falls through to
the generic object handling and produces broken SQL. Teach escape() about
Temporal, mirroring the existing Date handling.

- Instant / ZonedDateTime: absolute times, delegated to dateToString so the
  timezone argument behaves exactly as it does for Date (millisecond precision).
- PlainDateTime / PlainDate / PlainTime: wall-clock values, emitted verbatim as
  DATETIME / DATE / TIME literals (timezone ignored).
- Other Temporal types fall back to their ISO string.

Temporal types are detected via Object.prototype.toString (Symbol.toStringTag),
so the Temporal global is never referenced and no Temporal lib types are needed;
the new TemporalLike type is declared structurally. Adds tests (skipped when
Temporal is unavailable) and README docs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* refactor: use native Temporal types and cover the ISO fallback

- type Temporal values via the esnext.temporal lib (unblocked by #44)
  instead of the structural TemporalLike shape
- add tests for the ISO-string fallback (Duration, PlainYearMonth,
  PlainMonthDay)
- run Temporal tests on every runtime via @js-temporal/polyfill (dev-only)
  so coverage no longer depends on the CI Node version
- trim comments to decision notes per review

* refactor: simplify temporalToString with structural narrowing

* refactor: remove comments entirely, in line with codebase

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Weslley Araújo <46850407+wellwelwel@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants