Skip to content

feat(cli): on TypeScript 7, read types with its TypeScript 6 API package, and name the remedy - #7721

Merged
josephfarina merged 4 commits into
mainfrom
josephfarina/typescript-fix-in-skip-reasons
Oct 20, 2026
Merged

josephfarina merged 4 commits into
mainfrom
josephfarina/typescript-fix-in-skip-reasons

Conversation

@josephfarina

@josephfarina josephfarina commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

User impact

TypeScript 7 is npm's latest, and it ships no JavaScript compiler API (createProgram). In a project on TypeScript 7, integration check skips the doc-type and prop comparisons, and --strict then fails with "TypeScript 7.0.2 is installed in this project, but it has no JavaScript compiler API (createProgram) to read types with, so docs were not checked.". That names the problem but not what to do. The skip reasons for a missing or too-old TypeScript ended with "Install typescript" or "Upgrade typescript", and today that installs TypeScript 7, which fails the same way.

Now:

  • TypeScript 7 works with its TypeScript 6 API package. TypeScript publishes @typescript/typescript6 for tools that need a compiler API beside TypeScript 7 (TypeScript 7.1 is expected to bring a new API). When the project's typescript has no createProgram, the checks use @typescript/typescript6 if the project installs it. So a TypeScript 7 project keeps TypeScript 7 for tsc and adds one package; it does not downgrade.
  • Every skip reason ends with the remedy: on TypeScript 7, add @typescript/typescript6; otherwise install TypeScript 5.0 through 6 (npm install -D typescript@6). 5.0 is the oldest version that checks a JavaScript doc. --strict fails with that message.

Reproduction

A new integration package with typescript 7.0.2 and @typescript/typescript6 6.0.2 installed from npm, then npx astryx integration check --strict:

[ok] Every doc matches its authoring type (1 checked).
[ok] Documented prop names and required flags match the code in 1 component(s) (TypeScript 6.0.3).
[ok] 0 errors, 0 warnings, 0 skipped. Every check passed.

Before this change, the same project failed --strict with 2 skipped comparisons. With TypeScript 7.0.2 alone :

skipped:  TypeScript 7.0.2 is installed in this project, but it has no JavaScript compiler API (`createProgram`) to read types with (TypeScript 7 ships none), so docs were not checked. On TypeScript 7, add its TypeScript 6 API package (`npm install -D @typescript/typescript6`); otherwise install TypeScript 5.0 through 6 (`npm install -D typescript@6`). Then run this check again.
[fail] 0 errors, 0 warnings, 2 skipped. --strict fails on every warning and on skipped work; fix them, or drop --strict to fail only on errors.

Before this change, the reason ended at "so docs were not checked.".

Fix

  • resolveProjectTypeScript (foundation/discovery/project-typescript.mjs): where the project's typescript has no createProgram, it tries @typescript/typescript6 from the same folder.
  • TYPESCRIPT_FIX: one sentence used by every skip reason. It covers no TypeScript, a TypeScript with no compiler API, a TypeScript older than the doc-type check reads, and, for prop types, older than 4.8.
  • No new check, finding, failure code, or JSON field. The skip codes and --strict behavior are unchanged; only the reason text changes (architecture:cli-surface INV33/INV34 already require saying why).

Compatibility

Message text only. The JSON shape, exit codes, and skip codes are unchanged.

Testing

  • New: TypeScript 7 plus a @typescript/typescript6 that re-exports a real TypeScript: the doc-type check reports checked, and the prop check compares (a number doc against string code is a type_mismatch).
  • The TypeScript 7 stub tests now assert that the reason names the version and @typescript/typescript6. These, the new tests, and the too-old cases fail without the change and pass here.
  • vitest run --project node packages/cli/foundation/discovery packages/cli/api/integration/check packages/cli/test/integration-check-failures.test.mjs packages/cli/clients/cli/commands/doctor-integration.test.mjs packages/cli/clients/cli/commands/integration-check.test.mjs: 1,203 pass across doc-compiler, discovery, integration check and test/.
  • tsc -p packages/cli/tsconfig.strict.json, eslint, Prettier, check:changesets, and changeset coverage pass.

When the project's TypeScript is missing, older than a check reads, or has no
JavaScript compiler API (TypeScript 7), the skip reason of the doc-type and
prop checks now names the version and what to do: install TypeScript 5.0
through 6 (`npm install -D typescript@6`). `integration check --strict`
fails with that message.
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 20, 2026 7:41am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 20, 2026
@astracat-bot

astracat-bot Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 20, 2026, 8:05 AM UTC

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

40 of 482 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 754,077
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,188
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
RichTextEditor Markdown parity: side by side probe dark 94,866
RichTextEditor Markdown parity: side by side probe light 89,762
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232
ProgressBar With Target Mark probe dark 7,895
ProgressBar With Target Mark probe light 7,895
Markdown Default neutral dark 7,573
Markdown Default neutral light 7,566

and 20 more.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@astracat-bot astracat-bot 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.

This looks good to merge: every TypeScript skip reason in integration check and in doctor integration validate and components now ends with a remedy that works, while the exit codes, skip codes and JSON shape stay the same. On a freshly scaffolded integration with TypeScript 7.0.2, following the new message (npm install -D typescript@6) makes integration check --strict pass with nothing skipped. One optional polish: the Changeset says the reasons "now name the version" and that --strict fails "instead of a bare skip", but the version was already named and --strict already failed with the reason, so only the remedy is new.

[Automated review]

'@astryxdesign/cli': patch
---

[fix] When the project's TypeScript is missing, too old, or has no JavaScript compiler API (TypeScript 7), `integration check` and `doctor integration validate|components` now name the version and the fix in the skip reason: install TypeScript 5.0 through 6 (`npm install -D typescript@6`). `--strict` fails with that message instead of a bare skip.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Optional wording: before this change the no-API and too-old reasons already named the installed version, and --strict already failed with the reason, so only the fix is new. For example: "... now end the skip reason with the fix: install TypeScript 5.0 through 6 (npm install -D typescript@6). --strict fails with the same message."

TypeScript 7 ships no JavaScript compiler API; TypeScript publishes
`@typescript/typescript6` for tools that need one. Where the project's
`typescript` has no `createProgram`, the checks now use that package when
it is installed, and the remedy names it first.
@josephfarina josephfarina changed the title fix(cli): a TypeScript the checks cannot use is named with the fix feat(cli): on TypeScript 7, read types with its TypeScript 6 API package, and name the remedy Oct 20, 2026
@josephfarina
josephfarina force-pushed the josephfarina/typescript-fix-in-skip-reasons branch from 1b42268 to 6680658 Compare October 20, 2026 06:41

@astracat-bot astracat-bot 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.

Changes requested: the @typescript/typescript6 fallback works, and a TypeScript 7 package that installs it now passes integration check --strict with both comparisons run, but the docs still describe the old rule. Please update the help and guides that say the checks read only the project's own typescript (the doctor integration components and validate command docs, the integrationComponentConflicts and validateIntegration API docs, and the check-the-props, check-your-docs and checks guides), and the quick start, which tells TypeScript 7 users the checks skip (quick-start.doc.mjs:52), since automatic CLI behavior must be documented and discoverable (AST-017 FR14). Describe the condition the code implements, which also covers a folder with no typescript installed; no code change is needed.

[Automated review]

Comment on lines +58 to +67
// TypeScript 7 has no JavaScript compiler API; the package TypeScript
// ships beside it for tools that need one carries TypeScript 6's.
try {
const ts = require(TYPESCRIPT_6_API);
if (ts && typeof ts.createProgram === 'function') {
return {ts, version: String(ts.version)};
}
} catch {
// Not installed from here; try the next directory.
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This fallback is automatic CLI behavior, so AST-017 FR14 needs it documented and discoverable, but the help and guides still say the checks read the project's own typescript (doctor-integration-components.doc.mjs, doctor-integration-validate.doc.mjs, integrationComponentConflicts.doc.mjs, validateIntegration.doc.mjs, check-the-props.doc.mjs, check-your-docs.doc.mjs, checks.doc.mjs), and quick-start.doc.mjs:52 says TypeScript 7 makes the checks skip. Please describe it there.

This require also runs when no typescript resolves from the folder (the catch above falls through to it), so a package with only @typescript/typescript6 is checked with it too; the docs should say so.

'@astryxdesign/cli': patch
---

[feat] On TypeScript 7, which ships no JavaScript compiler API, the doc-type and prop checks in `integration check` and `doctor integration validate|components` use the TypeScript 6 API package TypeScript publishes for tools (`@typescript/typescript6`) when the project installs it beside TypeScript 7. When no usable TypeScript is found, the skip reason now ends with the remedy: add `@typescript/typescript6` on TypeScript 7, or install TypeScript 5.0 through 6 (`npm install -D typescript@6`).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The fallback also applies where no typescript is installed at all, not only beside TypeScript 7: a package with only @typescript/typescript6 now runs both comparisons and passes --strict. Saying so here keeps the release note in line with the code.

…ypescript cannot be used

The command docs, API docs, check guides and quick start now say the doc-type
and prop checks use the project's `@typescript/typescript6` where its own
`typescript` is missing or has no JavaScript compiler API (TypeScript 7).

@astracat-bot astracat-bot 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.

Looks good to merge: with @typescript/typescript6 installed beside TypeScript 7, integration check --strict now runs both the doc-type and prop comparisons (through TypeScript 6.0.3), and every TypeScript skip reason ends with a remedy that works. The help, API docs and guides now describe the fallback, including a folder with no typescript, and the exit codes, skip codes and JSON shape are unchanged. Nothing further is needed from you.

[Automated review]

@josephfarina
josephfarina merged commit 55d8dff into main Oct 20, 2026
50 checks passed

This branch was successfully deployed

1 active deployment
Preview — 4b00d50d Deployed Oct 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant