Skip to content

Commit 1774667

Browse files
committed
Fix twoslash types issue
1 parent 25e770f commit 1774667

1 file changed

Lines changed: 58 additions & 3 deletions

File tree

docs/types/fast-elements.d.ts

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,62 @@
11
// Type definitions for fast-* JSX elements used in documentation examples
22
// This ensures TypeScript recognizes these elements during twoslash compilation
33

4-
import '@react-facet/dom-fiber'
4+
import { FacetProp } from '@react-facet/core'
55

6-
// The types are already declared globally in @react-facet/dom-fiber
7-
// This file just ensures they're loaded during docs compilation
6+
// Simplified type definitions for fast-* elements based on @react-facet/dom-fiber
7+
interface ElementProps {
8+
key?: string | number
9+
children?: React.ReactNode
10+
className?: FacetProp<string | undefined>
11+
id?: FacetProp<string | undefined>
12+
onClick?: (event: MouseEvent) => void
13+
onKeyUp?: (event: KeyboardEvent) => void
14+
onMouseDown?: (event: MouseEvent) => void
15+
onMouseMove?: (event: MouseEvent) => void
16+
onMouseUp?: (event: MouseEvent) => void
17+
style?: { [key: string]: FacetProp<string | number | undefined> }
18+
disabled?: FacetProp<boolean | undefined>
19+
type?: FacetProp<string | undefined>
20+
value?: FacetProp<string | undefined>
21+
href?: FacetProp<string | undefined>
22+
target?: FacetProp<string | undefined>
23+
src?: FacetProp<string | undefined>
24+
width?: FacetProp<string | undefined>
25+
height?: FacetProp<string | undefined>
26+
rows?: FacetProp<number | undefined>
27+
maxLength?: FacetProp<number | undefined>
28+
}
29+
30+
interface TextProps {
31+
text: FacetProp<string | number>
32+
}
33+
34+
declare global {
35+
namespace JSX {
36+
interface IntrinsicElements {
37+
'fast-a': ElementProps
38+
'fast-div': ElementProps
39+
'fast-span': ElementProps
40+
'fast-p': ElementProps
41+
'fast-img': ElementProps
42+
'fast-textarea': ElementProps
43+
'fast-input': ElementProps
44+
'fast-text': TextProps
45+
'fast-svg': ElementProps
46+
'fast-circle': ElementProps
47+
'fast-ellipse': ElementProps
48+
'fast-line': ElementProps
49+
'fast-path': ElementProps
50+
'fast-rect': ElementProps
51+
'fast-foreignObject': ElementProps
52+
'fast-use': ElementProps
53+
'fast-polyline': ElementProps
54+
'fast-polygon': ElementProps
55+
'fast-linearGradient': ElementProps
56+
'fast-radialGradient': ElementProps
57+
'fast-stop': ElementProps
58+
'fast-svg-text': ElementProps
59+
'fast-pattern': ElementProps
60+
}
61+
}
62+
}

0 commit comments

Comments
 (0)