Skip to content

TS7016 errors for consumers: missing @types/react-dom and @types/react-reconciler #83

@enitrat

Description

@enitrat

Bug

When a consumer installs smithers-orchestrator and runs tsc, they get TS7016 errors from smithers' own source files:

node_modules/smithers-orchestrator/src/components.ts(2,38): error TS7016:
  Could not find a declaration file for module 'react-dom/server'.

node_modules/smithers-orchestrator/src/dom/renderer.ts(1,24): error TS7016:
  Could not find a declaration file for module 'react-reconciler'.

Setting skipLibCheck: true does not help because it only skips .d.ts files — smithers ships raw .ts source and its exports map points directly at them.

Root cause

  • @types/react-reconciler is in devDependencies (not installed transitively for consumers)
  • @types/react-dom is not listed at all
  • Since the package ships .ts source (not compiled .js + .d.ts), TypeScript type-checks the source files inside node_modules and needs these type packages

Minimal Reproducible Example

package.json

{
  "name": "smithers-mre",
  "private": true,
  "type": "module",
  "dependencies": {
    "smithers-orchestrator": "0.6.0",
    "typescript": "^5.8.0"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "jsx": "react-jsx",
    "jsxImportSource": "smithers-orchestrator",
    "strict": true,
    "skipLibCheck": true,
    "noEmit": true
  },
  "include": ["src"]
}

src/index.tsx

import { render } from "smithers-orchestrator/dom/renderer";

const tree = <div>hello</div>;
const result = render(tree);
console.log(result);

Reproduce:

npm install && npx tsc --noEmit

Expected: compiles cleanly
Actual: TS7016 errors from smithers' internal source files

Note: skipLibCheck: true is set but has no effect because smithers ships .ts files, not .d.ts.

Related

PR #76 addresses this (moves @types/react-reconciler to dependencies, adds @types/react-dom).

A longer-term fix would be shipping compiled .js + .d.ts output so skipLibCheck works as consumers expect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions