Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit a3ff167

Browse files
committed
feat(system): add ComponentWithProps type for exporting components with dynamic props (eg. theming props)
1 parent aff686d commit a3ff167

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

packages/system/src/system.types.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import {
2-
Component,
3-
Fragment,
4-
Suspense,
5-
Teleport,
6-
ComponentObjectPropsOptions,
7-
} from 'vue'
1+
import { Component, Fragment, Suspense, Teleport } from 'vue'
82
import {
93
SystemProps,
104
ResponsiveValue,
@@ -13,6 +7,19 @@ import {
137
} from '@chakra-ui/styled-system'
148
import { IntrinsicElementAttributes } from './dom.types'
159
import { Dict } from '@chakra-ui/utils'
10+
import { AllowedComponentProps, ComponentCustomProps, VNodeProps } from 'vue'
11+
12+
/**
13+
* Export component with custom type
14+
*
15+
* @example
16+
* export const CBox = CBoxImpl as ComponentWithProps<{hello?: string}>
17+
*/
18+
export type ComponentWithProps<P> = {
19+
new (): {
20+
$props: AllowedComponentProps & ComponentCustomProps & VNodeProps & P
21+
}
22+
}
1623

1724
export type Tag =
1825
| string

0 commit comments

Comments
 (0)