Skip to content

Commit

Permalink
chore: fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
productdevbook committed Dec 30, 2023
1 parent 3ff67ff commit f505ca5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 8 additions & 3 deletions packages/core/primitive/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
Events,
FunctionalComponent,
IntrinsicElementAttributes,
NativeElements,
ReservedProps,
StyleValue,
} from 'vue'
Expand Down Expand Up @@ -46,17 +47,21 @@ export interface NodeElementTagNameMap {
ul: HTMLUListElement
}

interface IntrinsicElements extends NativeElements {
[name: string]: any
}

export type ElementConstructor<P> =
| (new () => { $props: P })
| ((props: P, ...args: any) => FunctionalComponent<any, any>)

// extends keyof JSX.NaviteElements | ElementConstructor<any>
export type ComponentProps<
T extends keyof JSX.IntrinsicElements | ElementConstructor<any>,
T extends keyof IntrinsicElements | ElementConstructor<any>,
> = T extends ElementConstructor<infer P>
? P
: T extends keyof JSX.IntrinsicElements
? JSX.IntrinsicElements[T]
: T extends keyof IntrinsicElements
? IntrinsicElements[T]
: Record<string, never>

export type RefElement<T extends abstract new (...args: any) => any> = Omit<
Expand Down
5 changes: 3 additions & 2 deletions packages/tsconfig/node18.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
"_version": "18.2.0",
"compilerOptions": {
"lib": [
"ES2023",
"ESNext",
"DOM"
],
"module": "ESNext",
"target": "ES2022",
"target": "ESNext",
"strict": true,
"esModuleInterop": true,
"jsxImportSource": "vue",
"skipLibCheck": true,
"resolveJsonModule": true,
"forceConsistentCasingInFileNames": true,
Expand Down

0 comments on commit f505ca5

Please sign in to comment.