Skip to content

fix(app): emit declaration files and fix package type exports for external consumers#26

Merged
skulidropek merged 4 commits into
mainfrom
issue-25
Jun 19, 2026
Merged

fix(app): emit declaration files and fix package type exports for external consumers#26
skulidropek merged 4 commits into
mainfrom
issue-25

Conversation

@skulidropek

Copy link
Copy Markdown
Member
  • Add tsconfig.build.json that emits .d.ts only from src/ (excludes examples with test fixture imports)
  • Change build script to vite build && tsc -p tsconfig.build.json so declarations survive Vite's dist clean
  • Point exports.types from ./src/index.ts to ./dist/index.d.ts so consumers get compiled declarations
  • Remove src/ from published files — only dist/ is shipped
  • Add tests/consumer/ fixture with strict tsconfig and proof-obligation import to pass tsc --noEmit

Closes #25

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

…ernal consumers

- Add tsconfig.build.json that emits .d.ts only from src/ (excludes examples with test fixture imports)
- Change build script to vite build && tsc -p tsconfig.build.json so declarations survive Vite's dist clean
- Point exports.types from ./src/index.ts to ./dist/index.d.ts so consumers get compiled declarations
- Remove src/ from published files — only dist/ is shipped
- Add tests/consumer/ fixture with strict tsconfig and proof-obligation import to pass tsc --noEmit

Closes #25

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@skulidropek

skulidropek commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

AI Session Backup

Commit: c7fe624
Status: skipped
Message: No session directories found.

git status

On branch issue-25
Your branch is up to date with 'origin/issue-25'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	scripts

nothing added to commit but untracked files present (use "git add" to track)

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@skulidropek, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 47 minutes and 28 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7d7ecebb-f774-4fc6-99d3-b501d4cb42c9

📥 Commits

Reviewing files that changed from the base of the PR and between c7fe624 and 0eb9ca7.

📒 Files selected for processing (4)
  • packages/app/package.json
  • packages/app/tests/consumer/index.ts
  • packages/app/tests/consumer/tsconfig.json
  • packages/app/tsconfig.json
📝 Walkthrough

Walkthrough

The package build pipeline is updated to emit TypeScript declaration files via a new tsconfig.build.json. The package.json exports are changed to resolve types from dist/index.d.ts instead of src/index.ts, and the files whitelist is narrowed to dist only. A new consumer proof test and its tsconfig are added to verify the public API compiles correctly from an external consumer perspective.

Changes

Fix Published Type Exports

Layer / File(s) Summary
Declaration build and package entrypoint fix
packages/app/tsconfig.build.json, packages/app/package.json
tsconfig.build.json is introduced to emit declaration-only output from src into dist. package.json changes the types export condition from ./src/index.ts to ./dist/index.d.ts, removes src from the files whitelist, extends build to run both vite build and tsc -p tsconfig.build.json, and adds a test:consumer script.
Consumer compile-time proof test
packages/app/tests/consumer/tsconfig.json, packages/app/tests/consumer/index.ts
A new tsconfig.json configures strict NodeNext type-checking with a paths alias resolving the package to ../../dist/index.d.ts. index.ts defines a typed /health GET path, instantiates createClientEffect<Paths>(), and asserts client.GET("/health") resolves at compile time via tsc --noEmit.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop hop, no more src in the box,
The types now live in dist, tidy as socks.
A consumer test says "yes, this compiles!"
Declaration maps stretch on for miles.
The bunny ships clean — no leaky files! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the primary change: fixing package type exports and ensuring declaration files are emitted for external consumers.
Description check ✅ Passed The description comprehensively explains the changes made and their rationale, directly addressing the linked issue #25 with clear bullet points of modifications.
Linked Issues check ✅ Passed All coding requirements from issue #25 are met: declaration files are emitted via tsconfig.build.json, exports.types now points to compiled dist/index.d.ts, src/ is removed from published files, and a consumer test fixture with strict tsconfig validates external usability.
Out of Scope Changes check ✅ Passed All changes are directly aligned with issue #25 requirements: build configuration updates, package.json exports/files modifications, and consumer test fixture creation are all within scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-25

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

Comment @coderabbitai help to get the list of available commands and usage tips.

…use)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@skulidropek

skulidropek commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

AI Session Backup

Commit: fff5520
Status: skipped
Message: No session directories found.

git status

On branch issue-25
Your branch is up to date with 'origin/issue-25'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	scripts

nothing added to commit but untracked files present (use "git add" to track)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/app/package.json`:
- Around line 21-30: The test:consumer script currently typechecks against
declarations in ../../dist/index.d.ts without ensuring those declarations are
built first, which causes failures on clean checkouts. Modify the test:consumer
script in the scripts section to include the build step before running the
typecheck command, either by prepending the build task directly to the
test:consumer script or by creating a pretest:consumer hook that runs the build
step automatically. This ensures the declaration files exist before the consumer
proof test attempts to validate against them.

In `@packages/app/tests/consumer/tsconfig.json`:
- Around line 10-12: Add a `baseUrl: "."` property to the tsconfig.json file in
the paths configuration block alongside the existing `paths` mapping for
`@prover-coder-ai/openapi-effect`. This ensures TypeScript's module resolution
properly follows the package.json exports.types entry instead of bypassing
normal module resolution through the direct dist path mapping.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ba868e59-d79e-4feb-a59b-53cc3f468911

📥 Commits

Reviewing files that changed from the base of the PR and between 564ef0a and c7fe624.

📒 Files selected for processing (4)
  • packages/app/package.json
  • packages/app/tests/consumer/index.ts
  • packages/app/tests/consumer/tsconfig.json
  • packages/app/tsconfig.build.json

Comment thread packages/app/package.json Outdated
Comment thread packages/app/tests/consumer/tsconfig.json
tests/consumer has its own tsconfig.json with paths mapping for
@prover-coder-ai/openapi-effect. Including it in the main tsc --noEmit
causes TS2307 since the package isn't resolved in the monorepo context.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@skulidropek

skulidropek commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

AI Session Backup

Commit: c8a0046
Status: skipped
Message: No session directories found.

git status

On branch issue-25
Your branch is up to date with 'origin/issue-25'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	scripts

nothing added to commit but untracked files present (use "git add" to track)

…k, add baseUrl

- test:consumer now runs tsc -p tsconfig.build.json first so the script
  works on a clean checkout without a pre-built dist/
- Add baseUrl: "." to tests/consumer/tsconfig.json alongside paths so
  TypeScript module resolution follows the standard paths protocol

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@skulidropek

skulidropek commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

AI Session Backup

Commit: 0eb9ca7
Status: skipped
Message: No session directories found.

git status

On branch issue-25
Your branch is up to date with 'origin/issue-25'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	scripts

nothing added to commit but untracked files present (use "git add" to track)

@skulidropek skulidropek merged commit ccd7612 into main Jun 19, 2026
9 checks passed
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.

Fix published package type exports for external consumers

1 participant