preact-typescript-jsx
/preact-typescript-jsx
Pomaga skonfigurować TypeScript w Preact: transformację JSX, jsxImportSource, ścieżki preact/compat i konflikty typów React.
- Autor
- janzsh ↗
- Repozytorium
- portfolio ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 07.11.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 2
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 1
Brak sygnałów. Repozytorium zmienione 07.11.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Pomaga skonfigurować TypeScript w Preact: transformację JSX, jsxImportSource, ścieżki preact/compat i konflikty typów React.
Oryginalny opis (EN)
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.
Jak działa
- Config
- tsconfig.json — Preact-only
- tsconfig.json — with preact/compat for React libraries
- Common Types
Podgląd SKILL.md
---
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).
Pliki w paczce (2)
- SKILL.md 2 KB
- agents/openai.yaml 1 KB
Wersje
W bazie nie ma innych skilli o nazwie preact-typescript-jsx.
Migawka bazy z 13.11.2026 · wersja paczki 0d495028976a (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100preact-compat-aliasing
Pomaga w migracji kodu React do Preact: aliasy bundlera, preact/compat, react/jsx-runtime i diagnoza zduplikowanych kopii. - 100preact
Pomaga budować aplikacje w Preact, 3-kilobajtowej alternatywie dla Reacta z tym samym API, hookami, JSX i sygnałami @preact/signals, także z biblioteką komponentów React przez preact/compat. - 100preact-signals-preact-integration
Pomaga używać sygnałów @preact/signals w komponentach Preact: useSignal, useComputed, renderowanie w JSX i ponowne renderowanie. - 100preact
Pilnuje, by aplikacja Preact działała jako zamiennik Reacta: sygnały do stanu, warstwa compat i lekkie paczki. - 100preact-stinger
Buduje aplikacje i widgety w Preact 11: sygnały, migracja z React compat, osadzenia, wyspy Astro i Fresh. - 100hono-jsx
Pomaga budować interfejs aplikacji Hono z hono/jsx: strony, layouty i formularze renderowane na serwerze przez jsxRenderer, z Vite i komponentami klienckimi z hono/jsx/dom.