openpencil/packages/core/src/render/jsx-runtime.ts
Danila Poyarkov 31326e8e5e Eliminate as Record<string, unknown> casts
- Add index signature to NodeChange for Kiwi codec fields
- Add blobs field to FigmaMessage
- Use 'in' type guards instead of Record casts in ai-adapter
- Use Object.fromEntries for Partial<SceneNode> property copying
- Use satisfies instead of as for handle position map
- Type node() to accept { children?: unknown; [key: string]: unknown }
- Remove ext() helper in kiwi-convert (direct property access)

37 occurrences → 1 (Kiwi codec boundary only).
2026-03-06 21:43:32 +03:00

37 lines
897 B
TypeScript

import { node, type BaseProps, type TreeNode, type TextProps } from './tree'
export function jsx(type: string | ((props: BaseProps) => TreeNode), props: BaseProps): TreeNode {
if (typeof type === 'function') {
return type(props)
}
return node(type, props)
}
export const jsxs = jsx
export const jsxDEV = jsx
export function Fragment({ children }: { children?: unknown }): TreeNode {
return node('fragment', { children })
}
export namespace JSX {
export type Element = TreeNode
export interface IntrinsicElements {
frame: BaseProps
text: TextProps
rectangle: BaseProps
ellipse: BaseProps
line: BaseProps
star: BaseProps & { points?: number; innerRadius?: number }
polygon: BaseProps & { pointCount?: number }
vector: BaseProps
group: BaseProps
section: BaseProps
}
export interface ElementChildrenAttribute {
children: {}
}
}