preact-typescript-jsx
/preact-typescript-jsx
Use when configuring Preact TypeScript, JSX transforms, jsxImportSource, preact/compat TS paths, JSX namespace augmentation, component children types, DOM event or ref types, or React type conflicts.
- Author
- janzsh ↗
- Repository
- portfolio ↗
- Licence
- MIT
- Last repository change
- 07.11.2026
Assessment and security
- Files in this package
- 2
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 1
No signals detected. Repository changed on 07.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use when configuring Preact TypeScript, JSX transforms, jsxImportSource, preact/compat TS paths, JSX namespace augmentation, component children types, DOM event or ref types, or React type conflicts.
Original author description
Use when configuring Preact TypeScript, JSX transforms, jsxImportSource, preact/compat TS paths, JSX namespace augmentation, component children types, DOM event or ref types, or React type conflicts.
How it works
- Config
- tsconfig.json — Preact-only
- tsconfig.json — with preact/compat for React libraries
- Common Types
SKILL.md preview
---
name: preact-typescript-jsx
description: "Use when configuring Preact TypeScript, JSX transforms, jsxImportSource, preact/compat TS paths, JSX namespace augmentation, component children types, DOM event or ref types, or React type conflicts."
---
# Preact TypeScript and JSX
Choose the JSX runtime first, then align TypeScript, Babel, bundler aliases, and test tooling with that choice.
## Config
- **Automatic JSX transform**: `"jsx": "react-jsx"` and `"jsxImportSource": "preact"`.
- **Classic transform**: `"jsx": "react"`, `"jsxFactory": "h"`, `"jsxFragmentFactory": "Fragment"`.
- **Babel-owned JSX**: `"jsx": "preserve"` in TS, but still set factory settings for type-checking.
- Rename JSX-bearing TypeScript files to `.tsx`.
## `tsconfig.json` — Preact-only
```json
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "Bundler",
"jsx": "react-jsx",
"jsxImportSource": "preact",
"strict": true,
"skipLibCheck": true
}
}
```
## `tsconfig.json` — with `preact/compat` for React libraries
```json
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact",
"strict": true,
"skipLibCheck": true,
"paths": {
"react": ["./node_modules/preact/compat/"],
"react/jsx-runtime": ["./node_modules/preact/jsx-runtime"],
"react-dom": ["./node_modules/preact/compat/"],
"react-dom/*": ["./node_modules/preact/compat/*"]
}
}
}
```
Use `skipLibCheck` when third-party React library declarations exceed compat's surface.
## Common Types
- **Children**: `ComponentChildren`; `FunctionComponent` includes children.
- **DOM props**: extend `HTMLInputAttributes`, `HTMLAttributes`, or per-element JSX interfaces.
- **Events**: Preact uses DOM events — prefer `TargetedEvent` / `TargetedMouseEvent` from `preact`, or inferred inline handlers.
- **Refs**: `createRef<T>()` and `useRef<T>(null)` need element generics under strict null checks.
- **Custom elements or attributes**: augment `namespace preact.JSX` in a module `.d.ts` file with `export {}` at the top to keep it a module.
```ts
// custom-elements.d.ts
import 'preact';
declare module 'preact' {
namespace JSX {
interface IntrinsicElements {
'my-widget': HTMLAttributes<HTMLElement> & { label?: string };
}
}
}
export {};
```
Doc anchors: [TypeScript](https://preactjs.com/guide/v10/typescript).
Files in this package (2)
- SKILL.md 2 KB
- agents/openai.yaml 1 KB
Versions
The database has no other skills named preact-typescript-jsx.
Database snapshot: 13.11.2026 · package version 0d495028976a (SHA-256 digest of the entire package)
Downloads in the last 30 days: 2 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100preact-compat-aliasing
Use when migrating React code or libraries to Preact, configuring preact/compat, bundler aliases, react/jsx-runtime, react-dom, Jest, Node SSR aliases, or diagnosing duplicate React/Preact copies and compat behavior differences. - 100preact
Preact is a 3kB alternative to React with the same modern API — components, hooks, and JSX — plus first-class fine-grained reactivity through `@preact/signals`. Use when a user wants to build a performance-critical web app, embedded widget, or mobile-first site with a smaller… - 100preact-signals-preact-integration
Use when working with @preact/signals in Preact components, including useSignal, useComputed, useSignalEffect, direct JSX signal rendering, DOM attribute optimization, Show, For, useLiveSignal, and rerender behavior. - 100preact
Use this skill when the user says 'Preact', 'Preact setup', 'Preact signals', 'Preact hooks', 'Preact vs React', 'Preact project', 'Preact SSR', or when creating a Preact application. This skill enforces: Preact as React drop-in, signals for state management, compat layer usage,… - 100preact-stinger
Build Preact 11 apps and widgets. Use for signals, React compat migration, embeds, Astro islands, or Fresh. Read README.md for the guide map. - 100hono-jsx
Use when building UI for a Hono app with hono/jsx — pages, layouts, forms, and interactive parts — server-rendered with jsxRenderer, developed and built with Vite, with client components via hono/jsx/dom. TRIGGER when tsconfig has jsxImportSource "hono/jsx", code imports…