Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JSX TypeScript type declarations #16

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading