chakra-ui-vue-next
chakra-ui-vue-next copied to clipboard
TS: Declare `chakra.element` types globally for factory function components.
Feature request
Is your feature request related to a problem? Please describe.
It is currently unclear how to provide Typescript SFC support for Chakra factory components that will be auto imported. For JavaScript projects he seems to work fine however we may need to provide a solution for TS SFCs.
At the moment the solution is to declare a global namespace for Chakra UI Vue components.
In TypeScript declaration file
declare global {
declare namespace chakra {
import { chakra } from '@chakra-ui/vue-next'
export const div: typeof chakra.div
}
}
export {}
In SFC
<template>
<chakra.div>value</chakra.div>
</template>
<script lang="ts" setup></script>