Repository navigation
fix: patch.create type declaration (TS1016) - #20
Merged
Merged
Conversation
The second overload declared a required `origin` after an optional `opts`, a TS1016 error for consumers with skipLibCheck false. `opts` is now `PKPatchUpdateOptions | undefined`, matching the runtime signature. Also fixes the README example (missing comma) and the rollup JSON import (`assert` -> `with`, rejected by Node 22). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a TypeScript error in the published type declarations (2.2.0 to 2.3.0). Version 2.3.1.
Problem
patch.createhas two overloads. The second declared a required parameter after an optional one:Any TypeScript project with
skipLibCheck: falsefails to compile as soon as it imports@placekit/client-js(directly or through@placekit/autocomplete-js/@placekit/autocomplete-react):Changes
src/placekit.d.ts:opts?: PKPatchUpdateOptions->opts: PKPatchUpdateOptions | undefinedin that overload. Matches the runtime signaturecreate(update, opts = {}, origin): callers can still passundefinedor an object asopts.README.md: missing comma in the "fixing an existing location" example.rollup.config.js: JSON import useswithinstead ofassert(assertis rejected by Node 22; supported by Node 18.20+/20.10+, CI runs Node 20).User-Agentstring.Testing
Consumer project (
strict,skipLibCheck: false) calling everypatch.createform (create(record),create(record, opts),create(partial, opts, origin),create(partial, undefined, origin),create(partial, {}, origin)) plussearch:Also checked on TypeScript 4.5, 5.9 and the 7.0 native preview, strict and non-strict,
exactOptionalPropertyTypes, andnode/node16/bundlerresolution: diagnostics differ only by the removed TS1016 line. Built output vs 2.3.0: only the version banner, theUser-Agentversion and this d.ts line differ.With
skipLibCheck: true, diagnostics are identical before and after, including invalid calls that must stay rejected (partial update withoutorigin).npm run lint,npm run buildandnpm test(41/41 on Node 20, as in CI) pass.Note:
npm test(node --test ./src) does not run on Node 22 (directory argument, and the tests assign the read-only globalnavigator). Unchanged here; CI uses Node 20.🤖 Generated with Claude Code