Skip to content

Types#7

Merged
marcopiraccini merged 2 commits into
mainfrom
types
May 28, 2026
Merged

Types#7
marcopiraccini merged 2 commits into
mainfrom
types

Conversation

@marcopiraccini

@marcopiraccini marcopiraccini commented May 28, 2026

Copy link
Copy Markdown
Contributor

Adds TypeScript type declarations to @platformatic/leader. The package is JS-only, and consumers on TypeScript 6 hit TS7016: Could not find a declaration file for module '@platformatic/leader' (TS 6 tightened the implicit-any fallback that TS 5 used to allow). This was surfaced by the typescript-v6 bump in platformatic/platformatic-world#41; shipping types here unblocks it.

Changes:

  • index.d.tsexport = createLeaderElector + declare namespace with Pool, Logger, NotificationChannel, LeaderElectorOptions, LeaderElector. Pool is a minimal structural type so the package's .d.ts doesn't pull in @types/pg or pino as peer-type requirements.
  • package.json"types": "index.d.ts", new test:types script (tsc -p tsconfig.json), typescript devDep.
  • tsconfig.json — strict, noEmit, nodenext, scoped to index.d.ts + the smoke.
  • test/types.test-d.ts — usage smoke (default-import, minimal + full options, returned methods). .test-d.ts suffix keeps it out of node --test test/*.test.js.
  • .github/workflows/ci.yml — explicit Type check step in the lint job (npm run test:types); added Node 26 to the test matrix.

Verified locally: npm run test:types passes under both TypeScript 5.9 and 6.0; npm test on Node 22/24/26; running the workflow build in platformatic-world against TS 6 with the new types no longer errors.

Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
@marcopiraccini marcopiraccini changed the title types Types May 28, 2026
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@marcopiraccini marcopiraccini merged commit 9066064 into main May 28, 2026
4 checks passed
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