Skip to content

Add package typecheck scripts#2312

Open
Tomeshwari-02 wants to merge 4 commits into
Karanjot786:mainfrom
Tomeshwari-02:fix/package-typecheck-scripts
Open

Add package typecheck scripts#2312
Tomeshwari-02 wants to merge 4 commits into
Karanjot786:mainfrom
Tomeshwari-02:fix/package-typecheck-scripts

Conversation

@Tomeshwari-02

@Tomeshwari-02 Tomeshwari-02 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add package-level typecheck scripts for TypeScript packages that did not participate directly
  • keep the command consistent with existing packages that use tsc --noEmit

Validation

  • Parsed all edited package.json files with Node
  • Bun is not installed in this environment, so turbo run typecheck was not run

Fixes #2302

Summary by CodeRabbit

  • Developer Experience
    • Added a dedicated type-checking command across project packages.
    • Type checks now focus on source files while excluding test files.
    • Improved type safety for registry data and animation sequence results.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Package-level typecheck scripts and scoped TypeScript configurations are added across the workspace. The motion sequence API gains explicit overloads, and create-termui-app types its registry response as RegistryIndex.

Changes

Typecheck and typing updates

Layer / File(s) Summary
Package typecheck setup
packages/{dev-server,jsx,motion,router,store,testing,tss,ui}/package.json, packages/{dev-server,jsx,motion,router,store,testing,tss,ui}/tsconfig.typecheck.json
Adds typecheck scripts using dedicated no-emit TypeScript configurations that include source files and exclude tests.
Motion sequence overloads
packages/motion/src/sequence.ts
Separates sequence return types for AnimationRunner[] and SequenceStep[] inputs without changing runtime logic.
create-termui-app typechecking and registry typing
packages/create-termui-app/package.json, packages/create-termui-app/tsconfig.typecheck.json, packages/create-termui-app/src/commands/add.ts
Adds the package typecheck setup and asserts the fetched registry JSON as RegistryIndex.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: type:feature, level:intermediate

Suggested reviewers: Karanjot786

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description gives a brief summary, but it omits most required template sections like package list, type of change, and checklist. Add the required PR template sections, including Description, Related Issue, Which package(s), Type of Change, Checklist, and reviewer notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding package-level typecheck scripts.
Linked Issues check ✅ Passed The PR adds package-level typecheck scripts for the listed TypeScript packages, matching the linked issue's expected behavior.
Out of Scope Changes check ✅ Passed The extra type-only updates support the new typecheck scripts and no clearly unrelated changes are shown.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added area:jsx @termuijs/jsx area:ui @termuijs/ui area:tss @termuijs/tss area:dev-server @termuijs/dev-server labels Jul 10, 2026
@Tomeshwari-02 Tomeshwari-02 marked this pull request as ready for review July 10, 2026 12:01

@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: 1

🧹 Nitpick comments (1)
packages/dev-server/tsconfig.typecheck.json (1)

1-12: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider extracting a shared typecheck tsconfig base.

All packages now have identical tsconfig.typecheck.json files. A shared base (e.g., tsconfig.typecheck.base.json at the workspace root) extended by each package would eliminate duplication and simplify future updates to include/exclude patterns.

♻️ Optional: shared base approach
// tsconfig.typecheck.base.json (workspace root)
{
  "include": ["src/**/*.ts", "src/**/*.tsx"],
  "exclude": ["src/**/*.test.ts", "src/**/*.test.tsx", "src/**/__tests__/**"]
}
// packages/dev-server/tsconfig.typecheck.json
{
  "extends": ["../../tsconfig.typecheck.base.json", "./tsconfig.json"]
}
🤖 Prompt for 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.

In `@packages/dev-server/tsconfig.typecheck.json` around lines 1 - 12, Duplicate
typecheck configuration should be centralized. Add a workspace-level
tsconfig.typecheck.base.json containing the shared include and exclude patterns,
then update each package’s tsconfig.typecheck.json, including the dev-server
configuration, to extend both the shared base and its local tsconfig.json while
removing duplicated fields.
🤖 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/create-termui-app/src/commands/add.ts`:
- Line 91: The registry response is cast to RegistryIndex without runtime
validation. In the registry-fetching function, validate the parsed JSON with a
RegistryIndex schema or type guard before returning it, and handle invalid
payloads with an appropriate error instead of passing them to findComponentEntry
or printAvailableComponents.

---

Nitpick comments:
In `@packages/dev-server/tsconfig.typecheck.json`:
- Around line 1-12: Duplicate typecheck configuration should be centralized. Add
a workspace-level tsconfig.typecheck.base.json containing the shared include and
exclude patterns, then update each package’s tsconfig.typecheck.json, including
the dev-server configuration, to extend both the shared base and its local
tsconfig.json while removing duplicated fields.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4366fd5f-6e24-441f-9275-c2f45ed7515e

📥 Commits

Reviewing files that changed from the base of the PR and between 65d1f7e and 8620a12.

📒 Files selected for processing (20)
  • packages/create-termui-app/package.json
  • packages/create-termui-app/src/commands/add.ts
  • packages/create-termui-app/tsconfig.typecheck.json
  • packages/dev-server/package.json
  • packages/dev-server/tsconfig.typecheck.json
  • packages/jsx/package.json
  • packages/jsx/tsconfig.typecheck.json
  • packages/motion/package.json
  • packages/motion/src/sequence.ts
  • packages/motion/tsconfig.typecheck.json
  • packages/router/package.json
  • packages/router/tsconfig.typecheck.json
  • packages/store/package.json
  • packages/store/tsconfig.typecheck.json
  • packages/testing/package.json
  • packages/testing/tsconfig.typecheck.json
  • packages/tss/package.json
  • packages/tss/tsconfig.typecheck.json
  • packages/ui/package.json
  • packages/ui/tsconfig.typecheck.json

}

return await response.json();
return await response.json() as RegistryIndex;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- add.ts ---\n'
sed -n '1,220p' packages/create-termui-app/src/commands/add.ts

printf '\n--- RegistryIndex search ---\n'
rg -n "type RegistryIndex|interface RegistryIndex|RegistryIndex" packages/create-termui-app -S

printf '\n--- schema/validation search ---\n'
rg -n "zod|schema|validate|response\.json\(\) as RegistryIndex|RegistryIndex" packages/create-termui-app/src -S

Repository: Karanjot786/TermUI

Length of output: 247


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- add.ts ---'
sed -n '1,220p' packages/create-termui-app/src/commands/add.ts

echo
echo '--- RegistryIndex search ---'
rg -n "type RegistryIndex|interface RegistryIndex|RegistryIndex" packages/create-termui-app -S

echo
echo '--- schema/validation search ---'
rg -n "zod|schema|validate|response\.json\(\) as RegistryIndex|RegistryIndex" packages/create-termui-app/src -S

Repository: Karanjot786/TermUI

Length of output: 14138


Validate the registry JSON before casting it

packages/create-termui-app/src/commands/add.ts:91 still trusts the remote payload as RegistryIndex without any runtime check. A malformed response can fail later in findComponentEntry or printAvailableComponents; add a schema/type guard before returning it.

🤖 Prompt for 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.

In `@packages/create-termui-app/src/commands/add.ts` at line 91, The registry
response is cast to RegistryIndex without runtime validation. In the
registry-fetching function, validate the parsed JSON with a RegistryIndex schema
or type guard before returning it, and handle invalid payloads with an
appropriate error instead of passing them to findComponentEntry or
printAvailableComponents.

Source: Coding guidelines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-server @termuijs/dev-server area:jsx @termuijs/jsx area:tss @termuijs/tss area:ui @termuijs/ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add typecheck scripts to packages that only expose build/dev

1 participant