Skip to content

ci: check built declarations without the global React namespace - #128

Open
david-roper wants to merge 1 commit into
DouglasNeuroInformatics:mainfrom
david-roper:package-react-fix
Open

david-roper wants to merge 1 commit into
DouglasNeuroInformatics:mainfrom
david-roper:package-react-fix

Conversation

@david-roper

@david-roper david-roper commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Rebased on main (6.19.2). The source fix in this PR (import type * as React in 49 files) is removed, because #130 and #131 fixed the same problem on main with named type imports. This PR now contains only the regression guard for #126.

 .github/workflows/
-├── release.yaml          # build-command: pnpm build
+├── release.yaml          # build-command: pnpm build && pnpm lint:dist
-└── test.yaml             # lint, test
+└── test.yaml             # lint, test, build, lint:dist
+scripts/
+└── check-dist-types.js   # type-checks dist/**/*.d.ts as a consumer without the React global
 package.json              # + "lint:dist"
 tsconfig.json             # + scripts/**/* is type-checked
pnpm lint:dist            (run after pnpm build)
  remove `export as namespace React;` from @types/react in memory
  type-check each dist/**/*.d.ts with skipLibCheck: false
  fail if dist is empty, or if the global was not found in @types/react
  fail on a diagnostic in dist

libui's own tsc cannot find this class of error, because @types/react supplies the global React namespace.

Evidence

  • Before: a bare React.ComponentProps put into dist/components/Checkbox/Checkbox.d.ts by hand:
    Found 1 error(s) in 1 of 204 declaration file(s). (exit code 1)
    After: a clean build of this branch:
    Checked 204 declaration file(s) without the global React namespace: no errors.
  • pnpm lint and pnpm build pass. pnpm test: 41 files, 226 tests pass.

Merge Danger

Door: two-way

No published file changes. A revert removes the check only.

Blast Radius: CI

The test and release workflows now build and run lint:dist. A declaration that uses React without an import will stop the workflow. The commit type does not cause a release.

Closes #126

🤖 Generated with Claude Code

https://claude.ai/code/session_01W53iUSBaRj1XfMJBUUzmod

@gdevenyi gdevenyi changed the title fix(types): import React in files whose emitted declarations use React.* ci: check built declarations without the global React namespace Nov 10, 2026

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.

libui **6.18.0** publishes type declarations that reference a global React namespace without importing React.

1 participant