Skip to content

feat(typecheck): prompt to install vue-tsc and typescript#1316

Open
danielroe wants to merge 1 commit into
mainfrom
fix/typecheck-install-prompt
Open

feat(typecheck): prompt to install vue-tsc and typescript#1316
danielroe wants to merge 1 commit into
mainfrom
fix/typecheck-install-prompt

Conversation

@danielroe
Copy link
Copy Markdown
Member

@danielroe danielroe commented May 13, 2026

🔗 Linked issue

resolves nuxt/nuxt#35009

📚 Description

this adds a prompt to install vue-tsc + typescript if they are missing and can't be resolved.

this might break users if they were relying on the implicit npx vue-tsc behaviour but it's considerably safer to have typescript/vue-tsc installed (as they could break at any time!) and is easily worked around.

here's what it looks like

Screen.Recording.2026-05-13.at.21.28.24.mov

btw, I think we could build on this and automatically use golar if it's present/installed by user, without the need for config or flag (cc: @OskarLebuda)

@danielroe danielroe requested review from atinux and posva May 13, 2026 18:30
@danielroe danielroe force-pushed the fix/typecheck-install-prompt branch from 3fd74e1 to 013fd41 Compare May 13, 2026 18:32
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 13, 2026

  • nuxt-cli-playground

    npm i https://pkg.pr.new/create-nuxt@1316
    
    npm i https://pkg.pr.new/nuxi@1316
    
    npm i https://pkg.pr.new/@nuxt/cli@1316
    

commit: 013fd41

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR refactors the typecheck command to ensure required dev dependencies (typescript and vue-tsc) are explicitly available before execution. The command now concurrently detects TypeScript project references, calls an ensureVueTsc helper to verify or install missing packages via the detected package manager with user confirmation, generates Nuxt types, executes vue-tsc with appropriate flags, and reports the result. Previous ad-hoc bun/npx fallback logic has been removed. The playground package now declares typescript and vue-tsc as dev dependencies, and knip.json is updated to ignore vue-tsc in unused dependency checks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description clearly explains the changes: adding a prompt to install missing vue-tsc and typescript dependencies, with context about breaking changes and a video demonstration.
Title check ✅ Passed The title accurately reflects the main change: adding a prompt to install missing dependencies (vue-tsc and typescript) in the typecheck command.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/typecheck-install-prompt

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/nuxi/src/commands/typecheck.ts (1)

128-128: ⚡ Quick win

Consider logging if resolution fails after successful installation.

After successfully installing dependencies, if resolveDeps({ cache: false })['vue-tsc'] returns undefined, the function silently returns undefined without explaining why resolution failed post-installation. While this edge case is caught by the check at line 58, adding a logger statement here would help users debug this unexpected scenario.

📝 Proposed logging enhancement
+  const resolved = resolveDeps({ cache: false })['vue-tsc']
+  if (!resolved) {
+    logger.error(`Failed to resolve ${colors.cyan('vue-tsc')} after installation. Please check your installation.`)
+  }
-  return resolveDeps({ cache: false })['vue-tsc']
+  return resolved
🤖 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/nuxi/src/commands/typecheck.ts` at line 128, The call resolveDeps({
cache: false })['vue-tsc'] can return undefined after installation but currently
silently returns; update the code in typecheck.ts around the return to detect a
falsy result from resolveDeps({ cache: false }) and log a clear message via the
existing logger (or processLogger) indicating that dependency resolution for
'vue-tsc' failed after install and include any relevant context (e.g., that
installation succeeded but resolution returned undefined), then return or throw
as appropriate; reference the resolveDeps function call and the 'vue-tsc' lookup
to locate the change.
🤖 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.

Nitpick comments:
In `@packages/nuxi/src/commands/typecheck.ts`:
- Line 128: The call resolveDeps({ cache: false })['vue-tsc'] can return
undefined after installation but currently silently returns; update the code in
typecheck.ts around the return to detect a falsy result from resolveDeps({
cache: false }) and log a clear message via the existing logger (or
processLogger) indicating that dependency resolution for 'vue-tsc' failed after
install and include any relevant context (e.g., that installation succeeded but
resolution returned undefined), then return or throw as appropriate; reference
the resolveDeps function call and the 'vue-tsc' lookup to locate the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c4f54fcc-6438-44ad-a35a-52801345d9c1

📥 Commits

Reviewing files that changed from the base of the PR and between 8c4bcf6 and 3fd74e1.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • knip.json
  • packages/nuxi/src/commands/typecheck.ts
  • playground/package.json

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 13, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing fix/typecheck-install-prompt (013fd41) with main (8c4bcf6)

Open in CodSpeed

@OskarLebuda
Copy link
Copy Markdown
Contributor

That's good idea! Let me know if you merge it. I'll create a pr for golar with additional docs for it 🙏🏻

@danielroe danielroe changed the title feat(nuxi): prompt to install vue-tsc and typescript for typecheck feat(typecheck): prompt to install vue-tsc and typescript for typecheck May 14, 2026
@danielroe danielroe changed the title feat(typecheck): prompt to install vue-tsc and typescript for typecheck feat(typecheck): prompt to install vue-tsc and typescript May 14, 2026
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.

Cannot find module with typecheck

2 participants