/tsh-stack-frontend:configuring-typescript-for-frontendfrom TSH Stack: Frontend
Configures TypeScript for browser-targeted frontend projects: version pinning, tsconfig baseline for bundler-resolved apps, and React + Vite project layout. Use when starting a frontend project, editing tsconfig, diagnosing JSX or module-resolution errors, or upgrading TypeScript.
Ships in TSH Stack: Frontend. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
TSH's recommended TypeScript setup for code that runs in a browser: which
version to pin, the tsconfig.json baseline for a bundler-resolved app, and the
React + Vite project layout.
This skill is about configuration. How to model types — unions, branded types,
unknown over any — is out of its scope, as are component patterns, state
management, and styling. Node-targeted server code is out of scope too: it resolves
modules differently and needs its own config, so a repo with both compiles them as
separate projects.
tsconfig.json for a new frontend app, or reviewing an existing onetarget, lib, module, and moduleResolution for a bundled appvite.config.ts and other build-time filesimport.meta.env, static asset imports, or other bundler-provided globalsThe concrete layout in this skill is written against Vite 8 + React 19 with
TypeScript in the 6.x line, which is what create-vite's React + TypeScript
template currently ships. Note that 7.x is the latest stable TypeScript line, so
the template is deliberately one major behind — see
typescript-version-and-upgrades.md
for why that gap exists and when to close it. Read the target repository's
package.json before applying anything here.
Earlier Vite majors, and TypeScript 5.x, are fully supported by the principles
here — but the file layout and several defaults differ, so check the versions in
play before copying any config verbatim. For a project on Vue, Svelte, Angular, or
Next.js, treat the compiler-option guidance as applicable and the Vite-specific
layout as illustrative only.
Read the target repository's tsconfig.json (and anything it extends),
package.json, and bundler config before proposing anything. Local conventions
outrank this skill's defaults. Apply this guidance where the repository is
silent, and record a deliberate deviation rather than silently mixing conventions.
The baseline below is a recommendation for new projects, not a verdict on
existing ones. A working tsconfig.json that differs from it is not a defect.
In an existing repo, propose the smallest staged change that serves the task at
hand and read
adopting-in-a-brownfield-project.md
before proposing anything wider.
Framework requirements outrank this skill. A meta-framework that owns its own config — Next.js, Angular, SvelteKit, Nuxt — wins for the files it generates; do not hand-edit fields the framework manages.
| Severity | Rule |
|---|---|
| MUST | Treat this baseline as a recommendation for new projects. In an existing repo, propose the smallest staged change and record the remaining gap — never rewrite a working tsconfig.json wholesale to match this skill. |
| MUST | Run a real type-check in CI as its own step (tsc -b, or tsc --noEmit on a single-config project). Vite, esbuild, and SWC strip types without checking them — a green vite build proves nothing about type correctness. |
| MUST | Enable strict. A project that cannot turn it on wholesale enables the individual flags progressively and records the remaining gap — never ships strict: false as a permanent state. |
| MUST | Pin an exact TypeScript version in devDependencies (no ^). TypeScript does not follow semver — patch and minor releases add errors to previously compiling code. |
| MUST | Use moduleResolution: bundler only where a bundler actually resolves the imports. Build-time files that Node executes directly — vite.config.ts, scripts — belong in a separate config with a Node resolution mode. |
| NEVER | Leave moduleResolution: node/node10 in a frontend project. It predates package.json exports, resolves the wrong entry point for modern packages, and TypeScript 6.0 deprecates it (it errors unless ignoreDeprecations: "6.0" is set) ahead of removal in 7.0. |
| MUST | Set noEmit: true when a bundler owns the output. allowImportingTsExtensions is only legal alongside it, and two tools emitting into the same tree is a debugging trap. |
| MUST | Mirror every paths alias in the bundler's own resolver (or generate both from one source). tsc rewrites nothing — an unmirrored alias type-checks and then fails at build or run time. |
| MUST | Declare bundler-injected globals in a .d.ts the project owns — import.meta.env, asset imports, vite/client. Reaching for any because "the bundler provides it" discards the one place those values can be typed. |
| MUST | Treat a @ts-expect-error as debt: it carries a comment explaining the cause and the condition for removal. Prefer it over @ts-ignore, which silently rots when the error disappears. |
| Reference | Load when | Covers |
|---|---|---|
| Compiler options for the browser | Writing or reviewing a frontend tsconfig.json | The baseline config, strictness ladder, target/lib/module/moduleResolution for a bundled app, jsx, types, emit ownership |
| React + Vite project | The project is built with Vite, or needs a second config for build-time files | The split-config layout, tsc -b as the type gate, vite/client and import.meta.env typing, path aliases, React-specific options |
| Version and upgrades | Choosing, justifying, or raising the TypeScript version | Version policy, what each recent major added, the 6.0 default changes, the 7.0 native compiler and its frontend caveats, upgrade procedure and triage |
| Adopting in a brownfield project | The repo already has a working config that differs from the baseline | Staged adoption order, ratcheting, per-flag sequencing, recording a deviation, when to leave a config alone |
Step 1 — Read the ground truth. Open every tsconfig*.json in the repo and
note how they relate (a root config with references, a single flat config, or a
framework-generated one). Read package.json for the pinned TypeScript version,
the framework and bundler majors, and whether a real type-check runs in the
build, lint, or CI scripts.
Step 2 — Decide greenfield or brownfield. A new project takes the baseline as
written. An existing project gets the smallest staged change — read
adopting-in-a-brownfield-project.md
first.
Step 3 — Load the relevant references. Read
compiler-options-for-the-browser.md
before editing any tsconfig.json, and
react-vite-project.md before adding or
splitting a config in a Vite project.
Step 4 — Check the type gate first. Before tuning flags, confirm a real type-check runs and fails the build. Strictness is worth nothing if nothing runs the compiler; this is the single most common gap in a frontend repo.
Step 5 — Apply the smallest change. Prefer the narrowest edit that achieves the goal. Say explicitly when a change affects the bundler's behavior and not just type checking.
Step 6 — Verify. Run the type-check, the build, and the test suite. Load the
app in a browser after any change to target, lib, or the config split: a
passing type-check does not prove the bundle still runs.
tsh-product-engineering — TSH's discipline-level implementation and review
workflows, independent of language. Optional; treat it as a bonus, never a
prerequisite.This skill configures the TypeScript compiler only. It does not configure Node or server builds, does not set up bundler plugins beyond what typing requires, and does not cover type modelling, linting, formatting, or testing frameworks.
What SKILL.md sets; muted values are Claude Code's defaults
Trigger on: setting up tsconfig.json for a React or Vite app, moduleResolution bundler questions, jsx or DOM lib errors, a separate tsconfig for vite.config.ts, typing import.meta.env, path aliases that resolve in the editor but not in the build, a build that ships type errors because Vite only transpiles, or an upgrade of the pinned TypeScript version in a frontend repo.
Three short reads, in order
3 skills in this plugin
/ensuring-accessibilityWCAG 2.1 AA implementation patterns for building accessible frontend components: semantic HTML first, keyboard navigation and focus management, ARIA only where HTML falls short, contrast minimums, and an axe-core verification step. Use when implementing accessible components, adding keyboard or screen-reader support, or building inclusive forms and interactive widgets./implementing-frontendTSH conventions for any change to frontend application code, React today, with or without a design: components, custom hooks and the non-UI modules around them, named imports from react, typed props, module boundaries and barrel files, the three UI states every data-dependent component handles, design tokens, and a mandatory Figma read before markup when a design exists. Use when writing or refactoring any browser app code — a component, hook, store, API client, utility or module move, in a .ts, .tsx or .jsx file.npx claudepluginhub thesoftwarehouse/agentic-collections --plugin tsh-stack-frontendOther plugins' skills for the same job