Skip to content

fix: declare type declaration dependencies - #3602

Open
iliev-blnk wants to merge 1 commit into
diegomura:masterfrom
iliev-blnk:fix/declaration-dependencies
Open

iliev-blnk wants to merge 1 commit into
diegomura:masterfrom
iliev-blnk:fix/declaration-dependencies

Conversation

@iliev-blnk

Copy link
Copy Markdown

Fixes #3592

The published declarations import packages that aren't installed for consumers:

package declaration imports before
@react-pdf/font fontkit (types from @types/fontkit) @types/fontkit in devDependencies
@react-pdf/textkit fontkit, @react-pdf/font neither declared
@react-pdf/layout @react-pdf/font (HyphenationCallback) not declared

This PR moves @types/fontkit to dependencies in font and textkit, and adds @react-pdf/font to textkit and layout, as TypeScript's publishing guide recommends. @react-pdf/renderer users hit this through @react-pdf/types → @react-pdf/font.

/// <reference types="node" /> in textkit resolves without further changes: @types/fontkit depends on @types/node.

Verification

A clean pnpm project using the tsconfig from the issue (strict, skipLibCheck: false), with packed tarballs of font and textkit, and index.ts importing FontStore and textkit's Paragraph type:

  • master: TS7016 for fontkit in font and textkit, TS2688 for node, TS2580 for Buffer
  • this branch: no errors

font, textkit and layout tests pass (153 files, 1361 tests).

@react-pdf/render's declarations import pdfkit and @react-pdf/layout, which it only has as devDependencies. I left that out because it would add layout as a runtime dependency of render. I'm happy to include it if you'd like.

The published declarations of @react-pdf/font and @react-pdf/textkit
import fontkit, whose types come from @types/fontkit, which both list
only as a devDependency. textkit and layout also import types from
@react-pdf/font without depending on it. Projects that check library
declarations (skipLibCheck: false) fail to type-check until they add
these themselves.

Fixes diegomura#3592
@vercel

vercel Bot commented Oct 22, 2026

Copy link
Copy Markdown

@iliev-blnk is attempting to deploy a commit to the diegomura Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4da1381

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@react-pdf/font Patch
@react-pdf/textkit Patch
@react-pdf/layout Patch
@react-pdf/renderer Patch
@react-pdf/types Patch
@react-pdf/render Patch
@react-pdf/examples Patch
@react-pdf/math Patch
@react-pdf/mermaid Patch
@react-pdf/ui Patch
@react-pdf/stylesheet Patch
@react-pdf/tailwind Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
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.

@react-pdf/font: published types import fontkit, but @types/fontkit is only a devDependency

1 participant