#7847 · Docs fork loses Markdown callback types
Trusted base: df9619d8e8aac4aff00c0c3ff9b8ef4e2823e4f2 (fetched from the public target repository's main branch).
Verdict: REPRODUCED · Root-cause confidence: high · Reproduction label: confirmed-repro.
1. TL;DR
The Docs plugin fails typechecking when copied out of the workspace and installed with current npm dependencies. The workspace's frozen dependency graph still typechecks. The fork resolves a newer Markdown implementation with bundled ESM declarations that do not support the namespace-as-instance-type import used by tiptap-markdown. That invalid library type removes the contextual types of two local renderer callbacks, producing four implicit-any errors. Two fresh checkouts at the same trusted main commit reproduced the failure without modifying production code.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| A clean Docs fork fails with four TS7006 errors. | Verified | Both clean runs fail at raw-html.ts:76 and :122, for tokens and index. |
| The dependency graph now includes prosemirror-markdown 1.14.0 and two markdown-it versions. | Verified | Both fork installs resolve 1.14.0, hoisted markdown-it 15.0.3, and nested 14.3.3. @types/markdown-it is 13.0.9. |
| The release occurred on November 19 at 12:45 UTC. | Verified | The npm registry's publication timestamp is 2026-11-19T12:45:39.949Z. |
| The conflicting declarations come from the hoisted package. | Verified, with a correction | Actual tsrs resolution chooses dist/markdown-it.d.mts through import/types exports, not the .d.cts path suggested by the issue. |
| Workspace typechecking is unaffected. | Verified | The targeted Turbo typecheck succeeds: 6 successful tasks. The frozen lockfile resolves prosemirror-markdown 1.13.9. |
| Every affected CI shard fails, including unrelated pull requests. | Scope not exhaustively verified | The shared CI path invokes the reproduced checker. This investigation does not audit all historical CI runs or all plugin shards. |
| A local annotation fix passes the full fork pipeline. | Not executed here | An existing linked PR is reviewed statically only; no PR branch, patch, or test was run. |
3. Environment
- Linux x86_64; Node v22.19.0; pnpm 9.15.0.
- Two fresh detached Git worktrees at the trusted base commit; each uses its own frozen workspace install and newly generated external fork directory.
- Fork compiler: tsrs 0.18.0-ts7.1.0-dev.20260929; strict mode, bundler resolution, skipLibCheck enabled.
- No live app, production instance, provider session, network listener, or runtime store was used. No ports or runtime data directories were required.
- No dependency manifest, lockfile, production source, or stored data was changed.
4. Minimal reproduction
These commands use the trusted main commit and the checker inspected in repository source. The checker creates an isolated copy, packs the local SDK, installs the plugin's declared dependencies, and runs its normal typecheck. The failure occurs before its test and bundle stages.
git clone https://github.com/get-bb/bb.git bb-repro cd bb-repro git checkout --detach df9619d8e8aac4aff00c0c3ff9b8ef4e2823e4f2 pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build:types --filter=@get-bb/plugin-sdk node scripts/check-plugin-forks.mjs plugins/docs --keep
Expected: the declared Docs fork installs, typechecks, tests, and bundles successfully, ending with 1 forkable plugin(s) passed.
Actual, both clean runs (verbatim diagnostic excerpt):
plugins/docs: typecheck failed: npm run typecheck > bb-plugin-simple-notes@0.2.3 typecheck > tsrs --noEmit raw-html.ts(76,52): error TS7006: Parameter 'tokens' implicitly has an 'any' type. raw-html.ts(76,60): error TS7006: Parameter 'index' implicitly has an 'any' type. raw-html.ts(122,51): error TS7006: Parameter 'tokens' implicitly has an 'any' type. raw-html.ts(122,59): error TS7006: Parameter 'index' implicitly has an 'any' type. 1 of 1 forkable plugin(s) failed: plugins/docs
The checker exits 1 in each run. Its existing install/typecheck contract is the repeatable regression reproduction; no new test file is necessary for the report. Raw local logs and process paths are not published.
To inspect the kept fork, enter the Docs directory under the work directory printed by the checker, then run:
npm ls markdown-it prosemirror-markdown @types/markdown-it node_modules/.bin/tsrs --noEmit --traceResolution node_modules/.bin/tsrs --noEmit --skipLibCheck false
Both trace runs choose node_modules/markdown-it/dist/markdown-it.d.mts@15.0.3 when resolving markdown-it from tiptap-markdown/index.d.ts. Disabling library-check skipping in the first fork exposes the suppressed underlying error:
node_modules/tiptap-markdown/index.d.ts(32,50): error TS2709: Cannot use namespace 'MarkdownIt' as a type. node_modules/tiptap-markdown/index.d.ts(43,50): error TS2709: Cannot use namespace 'MarkdownIt' as a type.
5. Root cause
The fork checker resolves npm dependencies outside the workspace before running npm run typecheck. It is deliberately not the monorepo's frozen pnpm graph. Current installation resolves prosemirror-markdown@1.14.0, whose installed manifest allows markdown-it: ">=14 <=15".
bb-plugin-simple-notes@0.2.3 ├─┬ @tiptap/pm@2.27.3 │ └─┬ prosemirror-markdown@1.14.0 │ └── markdown-it@15.0.3 └─┬ tiptap-markdown@0.8.10 ├── @types/markdown-it@13.0.9 ├── markdown-it@14.3.3 └── prosemirror-markdown@1.14.0 deduped
The installed tiptap-markdown declaration imports import * as MarkdownIt from "markdown-it" and uses MarkdownIt as the setup callback's parameter type. Its nested 14.3.3 package has no matching TypeScript declaration. The resolver then finds the hoisted 15.0.3 package's own ESM types before falling back to the external @types package. Those ESM declarations export a named instance type and a default callable value; the namespace import is not that instance type.
With skipLibCheck enabled, the TS2709 errors inside the dependency are suppressed, but the local callbacks still lack contextual parameter types. The affected assignments are html_inline and html_block:
markdown.renderer.rules.html_inline = (tokens, index) => {
const source = tokens[index]!.content;
markdown.renderer.rules.html_block = (tokens, index) => {
const source = tokens[index]!.content;
Thus each of two callbacks produces two implicit-any errors. The shared CI fork-check step reaches this same path. The underlying dependency declaration mismatch is distinct from the local code's reliance on inferred callback parameters.
6. Proposed fix
Use explicit structural token-array and numeric-index parameter types at the two renderer assignments, reusing the existing local token interface. That keeps the code's actual input contract independent of the upstream declaration shape without changing dependencies or runtime behavior. An upstream declaration correction remains desirable. Validate any candidate against this external-fork reproduction as well as the Docs tests and workspace typecheck; a workspace-only typecheck does not exercise this failure.
No new fix branch or PR is created: an open linked PR already addresses this issue.
7. Linked PR review
PR #7848 — static match, not executed
GitHub metadata reports an open ready PR against main changing one file, with 8 additions and 2 deletions. The untrusted diff adds explicit token-array and numeric-index annotations to both affected renderer callbacks. This matches the local failure mechanism and has no visible runtime-expression change. No blocking static finding was identified in that narrow diff. The upstream namespace-type problem remains; the patch makes these local callbacks insensitive to it.
Verification limit: the PR branch, diff, and its tests were not checked out or run. All executed commands used trusted main. No new regression test is visible in the diff; the existing external-fork check is the relevant integration gate. This is not a verified pass verdict or a merge recommendation.
8. Verification
The same investigator repeated the reproduction in a second newly created detached worktree at the exact base commit. It received a separate frozen install, generated SDK types, and a new external fork directory; production code was unchanged. The second run used:
pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build:types --filter=@get-bb/plugin-sdk node scripts/check-plugin-forks.mjs plugins/docs --keep
Result: exit 1, the identical four TS7006 errors and identical dependency versions. A second compiler-resolution trace confirmed the same hoisted ESM declaration selection. No ports or instance data were needed. The report corrects the issue's suggested declaration suffix to .d.mts based on both traces. This is a second clean run by the same investigator, not independent verification.
9. Related issues and trust boundary
A repository issue search for Markdown typechecking surfaced no second issue with this same verified failure. This is a limited search, not an exhaustive duplicate guarantee. PR #7848 already links #7847 and prevents opening a duplicate fix PR. Issue content and the linked PR were treated as untrusted claims; no issue-supplied script, patch, branch, or external link was executed.
10. Appendix: preparation and controls
The first clean checkout's broad pnpm exec turbo run build attempt failed because first-party plugin builds could not resolve the not-yet-built SDK. Following repository guidance, generating the SDK's bundled types with its Turbo task repaired the prerequisite. The external-fork checker then successfully built and packed the SDK/CLI itself, installed the fork, and reached the target typecheck failure. This setup failure is not counted as reproduction evidence.
The workspace control command and result were:
pnpm exec turbo run typecheck --filter=bb-plugin-simple-notes Tasks: 6 successful, 6 total Cached: 5 cached, 6 total
Additional diagnostic commands: node --version, pnpm --version, uname -sm, npm view prosemirror-markdown time --json, dependency-tree inspection, compiler resolution tracing, and an explicit library check. An initial diagnostic attempt used the conventional TypeScript bin path, which this repository's aliased TypeScript package does not provide; it was corrected to the installed tsrs binary. Only the corrected command contributes to the compiler findings. Historical CI logs were not needed to establish this direct reproduction.