Conversation
configure rollup the same way as is 'react-final-form-arrays'
📝 WalkthroughWalkthroughAdds TypeScript declaration generation to the build: Rollup is configured with the TypeScript plugin and a build tsconfig that emits declarations; package.json gains a Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer/CI
participant Rollup as Rollup (build)
participant TS as TypeScript compiler
participant Dist as dist output (files)
Dev->>Rollup: run build
Rollup->>TS: invoke `@rollup/plugin-typescript` with tsconfig.build.json (declaration, declarationMap)
TS-->>Rollup: emit JS + `.d.ts` and `.d.ts.map` into declarationDir (`dist`)
Rollup->>Dist: write bundled JS and forward type files
Dev->>package.json: package.json.typings -> `dist/index.d.ts`
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@tsconfig.build.json`:
- Around line 8-10: Update the tsconfig.build.json exclude array to also omit
test-only files so declaration files aren't emitted for tests; specifically add
patterns such as "./src/**/*.test.tsx", "./src/**/*.test.ts", and a directory
pattern like "**/__tests__/**" (or similar) to the existing exclude list in
tsconfig.build.json so future TSX tests or __tests__ folders are ignored by the
declaration emit process.
erikras-richard-agent
left a comment
There was a problem hiding this comment.
Excellent work! 👏 This follows the same pattern as your fix for react-final-form-arrays (#186).
What this fixes:
- Generates TypeScript definitions at build time (currently missing)
- Replaces outdated/incompatible @types/final-form-focus
- Adds proper
typingsfield to package.json - Uses tsconfig.build.json to control declaration generation
Code review:
✅ Correct use of @rollup/plugin-typescript
✅ tsconfig.build.json properly extends base config and excludes tests
✅ Types exported from index.ts via export * from './types'
✅ CodeRabbit approved
✅ Follows Final Form ecosystem conventions
This is part of the broader effort to fix TypeScript type publishing across all Final Form repos. Great contribution!
@erikras - Recommend merge. This fixes a gap in the TypeScript migration.
8b2014a
|
✅ CodeRabbit feedback addressed Updated "exclude": [
"./src/**/*.test.ts",
"./src/**/*.test.tsx", // Added: TSX test files
"**/__tests__/**" // Added: Test directories
]This ensures that declaration files (
Ready for merge! 🎉 |
The type definitions exposition have not been included during TS migration. This produces defintions at build time the same way as other final-form libs especially
react-final-form-arrays.Currently the only TS type available is
@types/final-form-focuswhich is not compatible anymore with latest releases offinal-form:I can't prove this PR works, I've tested locally with success by installing it:
Summary by CodeRabbit