Skip to content

Commit 729dfc8

Browse files
committed
refactor(NcChip): use defineSlots for proper slot definition
This resolves 2 errors reported by Typescript when building the package (missing "private" type exports during the declaration creation). Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent d81f990 commit 729dfc8

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/components/NcChip/NcChip.vue

+13-6
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export default {
111111

112112
<script setup lang="ts">
113113
import { mdiClose } from '@mdi/js'
114-
import { computed, useSlots } from 'vue'
114+
import { computed } from 'vue'
115115
import { t } from '../../l10n.js'
116116

117117
import NcActions from '../NcActions/NcActions.vue'
@@ -162,8 +162,18 @@ const props = withDefaults(defineProps<{
162162
variant: 'secondary',
163163
})
164164

165-
const emit = defineEmits(['close'])
166-
const slots = useSlots()
165+
const emit = defineEmits<{
166+
/**
167+
* Emitted when the close button is clicked
168+
*/
169+
close: []
170+
}>()
171+
172+
const slots = defineSlots<{
173+
actions(): unknown
174+
default(): unknown
175+
icon(): unknown
176+
}>()
167177

168178
const canClose = computed(() => !props.noClose)
169179
const hasActions = () => Boolean(slots.actions?.())
@@ -173,9 +183,6 @@ const hasIcon = () => Boolean(props.iconPath || props.iconSvg || !!slots.icon?.(
173183
* Handle closing the chip (pressing the X-button)
174184
*/
175185
function onClose() {
176-
/**
177-
* Emitted when the close button is clicked
178-
*/
179186
emit('close')
180187
}
181188
</script>

0 commit comments

Comments
 (0)