Skip to content

Commit

Permalink
Merge pull request #16 from bqqbarbhg/jsx-types
Browse files Browse the repository at this point in the history
Fix JSX TypeScript type declarations
  • Loading branch information
oamaok committed Oct 31, 2023
2 parents 0709dd5 + c9b6597 commit 5e9ed95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions jsx-runtime.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { DefaultProps, NodeDescriptor } from './dist/kaiku'
import { DefaultProps, Child, NodeDescriptor } from './dist/kaiku'

declare namespace JSX {
type Element<T extends DefaultProps> = NodeDescriptor<T>
type ArrayElement = Element<any>[]
interface FunctionElement<T extends DefaultProps> {
(props: T): Element<T>
(props: T): Child
}
interface ElementClass<T extends DefaultProps> {
render(props: any): Element<T>
render(props: T): Child
}
type ElementChildrenAttribute = {
children: any
Expand Down
7 changes: 3 additions & 4 deletions src/kaiku.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ type HtmlElementProperties = Record<string, any> & {
}

export type DefaultProps = Record<string, any>
export type WithIntrinsicProps<T extends DefaultProps> = T extends {
children: any
export type WithIntrinsicProps<T extends DefaultProps> = T & {
children?: Child | Children
key?: string
}
? T
: T & { children?: Child | Children }
type LazyProperty<T> = T | (() => T)

type ClassComponentDescriptor<
Expand Down

0 comments on commit 5e9ed95

Please sign in to comment.