Skip to content

fix: add .js extensions to type-only imports for nodenext consumers - #3474

Open
imssurya wants to merge 1 commit into
TypeCellOS:mainfrom
imssurya:fix/nodenext-type-import-extensions
Open

imssurya wants to merge 1 commit into
TypeCellOS:mainfrom
imssurya:fix/nodenext-type-import-extensions

Conversation

@imssurya

@imssurya imssurya commented Dec 5, 2026 •

Copy link
Copy Markdown

Summary

With moduleResolution: node16/nodenext and skipLibCheck: false, the published @blocknote/core 0.57.0 types give errors, because some import type statements have no .js extension and end up in the .d.ts files as-is:

node_modules/@blocknote/core/types/src/api/nodeConversions/blockToNode.d.ts(2,98): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'.

With skipLibCheck: true there's no error, but the types those imports point to silently become any.

Rationale

Value imports already use .js everywhere, since import-eslint/extensions enforces it. The rule skips type-only imports by default, so these slipped through (9 in core, 21 in xl-ai, plus 4 in the dev-scripts templates). TypeScript also writes import("../..") paths in a couple of generated declarations because of them, which gives TS2307 under nodenext.

Changes

  • Add the .js (or /index.js) extension to every relative import type that was missing one.
  • Turn on checkTypeImports: true for import-eslint/extensions so it stays that way.

Only import type lines change, so there's no runtime change.

Impact

None for bundler resolution. nodenext users get correct types.

Testing

  • A consumer importing BlockNoteEditor from a packed @blocknote/core, nodenext, skipLibCheck: false: on TS 5.9.3, 6.0.3 and 7.0.2 the errors from @blocknote/core go from 7 (5 × TS2834, 2 × TS2307) to 0.
  • With the new lint setting, removing the extension from a type import gives Missing file extension; without it, the rule doesn't report it.
  • pnpm typecheck, vp fmt --check and the core tests (1505 passed) pass. pnpm lint reports the same results before and after; locally it has 17 errors that all come from xl-typst-compiler not building here (its WASM step).

Additional Notes

One more nodenext error is left on TS 6+: BlockNoteEditor.d.ts has import "../style.css", which gives TS2882. That needs a build change, so I left it out of this PR.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Standardized module paths across editor functionality, AI language support, and example templates.
    • Updated import checks to include type-only imports, helping catch inconsistent module paths.
  • User Impact

    • No changes to editor behavior, AI translations, or other end-user functionality.

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

vercel Bot commented Dec 5, 2026

Copy link
Copy Markdown

@imssurya is attempting to deploy a commit to the TypeCell Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Relative imports now use explicit .js extensions across core, example templates, and xl-ai. The ESLint extension rule now checks type imports.

Changes: Module Path Updates

Layer / File(s) Summary
Update import paths and enable type-import checks
packages/core/src/..., packages/dev-scripts/examples/template-react/*, packages/xl-ai/src/i18n/*, packages/xl-ai/src/i18n/locales/*, vite.config.ts
Relative imports use explicit .js extensions. The ESLint extension rule now checks type imports.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: nperez0111, yousefed, matthewlipski

Merge Risk: Minimal · up to 53634

This change fixes type-declaration resolution for consumers using node16 or nodenext module resolution and adds a lint check to prevent regressions. Runtime behavior is unchanged and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix: add .js extensions to type-only imports for nodenext consumers" matches the main change. The PR adds .js extensions to relative import type statements that lacked them, which fixes TS2…
Description check Passed The description covers the template's main sections: Summary, Rationale, Changes, Impact, and Testing. It explains the nodenext errors, the lint rule change, and the test results. The Screenshots/Vide…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix: add .js extensions to type-only imports for nodenext consumers" matches the main change. The PR adds .js extensions to relative import type statements that lacked them, which fixes TS2834/TS2307 errors for consumers using nodenext resolution. The title is specific and describes the primary change.

Full details: Description check

Explanation

The description covers the template's main sections: Summary, Rationale, Changes, Impact, and Testing. It explains the nodenext errors, the lint rule change, and the test results. The Screenshots/Video section is absent, which is acceptable because the change is not visual. The Checklist is also absent, and the Additional Notes section is present with relevant content. The description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks each path with care,
And finds .js extensions there.
Type imports join the rule’s review,
Locale paths are updated too.
The templates follow along,
Then hops away with one last song.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 000590f0-ae68-4bd3-a8d0-506ea507baac
Commits

Reviewing files that changed from the base of the PR and between 51ad2b4 and 5363416.

Files selected for processing: 34

  • packages/core/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts
  • packages/core/src/api/clipboard/fromClipboard/handleFileInsertion.ts
  • packages/core/src/api/clipboard/fromClipboard/pasteExtension.ts
  • packages/core/src/api/nodeConversions/blockToNode.ts
  • packages/core/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.ts
  • packages/core/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.ts
  • packages/core/src/util/table.ts
  • packages/core/src/yjs/extensions/index.ts
  • packages/dev-scripts/examples/template-react/index.html.template.tsx
  • packages/dev-scripts/examples/template-react/main.tsx.template.tsx
  • packages/dev-scripts/examples/template-react/tsconfig.json.template.tsx
  • packages/dev-scripts/examples/template-react/vite.config.ts.template.tsx
  • packages/xl-ai/src/i18n/dictionary.ts
  • packages/xl-ai/src/i18n/locales/ar.ts
  • packages/xl-ai/src/i18n/locales/de.ts
  • packages/xl-ai/src/i18n/locales/es.ts
  • packages/xl-ai/src/i18n/locales/fr.ts
  • packages/xl-ai/src/i18n/locales/he.ts
  • packages/xl-ai/src/i18n/locales/hr.ts
  • packages/xl-ai/src/i18n/locales/is.ts
  • packages/xl-ai/src/i18n/locales/it.ts
  • packages/xl-ai/src/i18n/locales/ja.ts
  • packages/xl-ai/src/i18n/locales/ko.ts
  • packages/xl-ai/src/i18n/locales/nl.ts
  • packages/xl-ai/src/i18n/locales/no.ts
  • packages/xl-ai/src/i18n/locales/pl.ts
  • packages/xl-ai/src/i18n/locales/pt.ts
  • packages/xl-ai/src/i18n/locales/ru.ts
  • packages/xl-ai/src/i18n/locales/sk.ts
  • packages/xl-ai/src/i18n/locales/uk.ts
  • packages/xl-ai/src/i18n/locales/vi.ts
  • packages/xl-ai/src/i18n/locales/zh-tw.ts
  • packages/xl-ai/src/i18n/locales/zh.ts
  • vite.config.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

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.

1 participant