Skip to content

feat(ci): typecheck TypeScript code blocks in wix-app references#686

Open
mirivoWix wants to merge 6 commits into
mainfrom
feat/wix-app-typecheck-ci
Open

feat(ci): typecheck TypeScript code blocks in wix-app references#686
mirivoWix wants to merge 6 commits into
mainfrom
feat/wix-app-typecheck-ci

Conversation

@mirivoWix

Copy link
Copy Markdown
Contributor

Summary

  • Adds a GitHub Actions workflow (.github/workflows/wix-app-typecheck.yml) that runs on every PR touching skills/wix-app/**
  • Extracts all ```typescript and ```tsx code blocks from 61 markdown reference files into .tsx files and runs tsc --noEmit
  • node_modules is cached keyed on package-lock.json hash — no reinstall on every run
  • Uses a two-pass tsc strategy: pass 1 identifies files with parse errors (non-self-contained blocks) and excludes them from a dynamic tsconfig for pass 2, so parse errors never suppress semantic analysis on well-formed files

What it catches

Real type errors in documentation examples — e.g. using a property that doesn't exist on a Wix API type, passing the wrong argument type to a Wix function, or object literals that violate a declared interface.

What it ignores (structural false-positives)

Code blocks in docs are often intentionally partial. The checker silently ignores errors that are artifacts of the extraction format: duplicate identifiers, missing imports, multiple default exports, non-self-contained JSX fragments, etc.

Pre-existing errors fixed in this PR

File Error Fix
DATA_COLLECTION.md dataPermissions: {} missing all required fields Added real AccessLevel values
DASHBOARD_API.md navigate({ relativeUrl }) without pageId Added @ts-ignore (valid at runtime; types are stricter)
WIX_DATA.md Intentional ❌ wrong-usage example Added @ts-ignore with note
BOOKINGS-STAFF-SORTING.md bookings.queryBookings not in installed types Added @ts-ignore (valid at runtime)
PAYMENT-SETTINGS.md Handler missing getPaymentSettingsForCheckout (now required); order.totalsorder.priceSummary.total.amount Added missing handler; fixed property path

Test plan

  • Confirm CI runs on this PR (it touches skills/wix-app/**)
  • CI should pass with ✅ No type errors found
  • Introduce a deliberate type error in any reference .md file → CI should fail with ❌

🤖 Generated with Claude Code

mirivoWix and others added 6 commits July 22, 2026 16:45
…nces

Adds a CI workflow that extracts all ```typescript/tsx code blocks from
skills/wix-app/references/**/*.md, generates .tsx files, and runs tsc
--noEmit to catch type errors in the documentation examples.

Key design decisions:
- Two-pass tsc approach: pass 1 finds structurally broken files (parse
  errors from non-self-contained code blocks) and excludes them from
  pass 2 via a generated tsconfig, ensuring parse errors don't suppress
  semantic analysis on well-formed files.
- node_modules cached via actions/cache@v4 keyed on package-lock.json
  hash — no reinstall on every run.
- Runs only on PRs that touch skills/wix-app/**, skips forks.
- Located in .github/wix-app-typecheck/ to avoid being published to npm
  (root package.json has "files": ["skills/**"]).

Also fixes 5 pre-existing type errors found by the new check:
- DATA_COLLECTION.md: add required dataPermissions field values
- DASHBOARD_API.md: suppress navigate({relativeUrl}) without pageId
- WIX_DATA.md: suppress intentional ❌ wrong-usage example
- BOOKINGS-STAFF-SORTING.md: suppress bookings.queryBookings (valid
  runtime API, types lag behind)
- PAYMENT-SETTINGS.md: add getPaymentSettingsForCheckout handler (now
  required by interface); fix order.totals → priceSummary.total.amount

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…erting @ts-ignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…@wix/environment-service

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant