Skip to content

Commit 6c2b368

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 <opensource@fthiessen.de>
1 parent d81f990 commit 6c2b368

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/components/NcChip/NcChip.vue

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ export default {
110110
</template>
111111

112112
<script setup lang="ts">
113+
import type { Slot } from 'vue'
114+
113115
import { mdiClose } from '@mdi/js'
114-
import { computed, useSlots } from 'vue'
116+
import { computed } from 'vue'
115117
import { t } from '../../l10n.js'
116118
117119
import NcActions from '../NcActions/NcActions.vue'
@@ -162,8 +164,18 @@ const props = withDefaults(defineProps<{
162164
variant: 'secondary',
163165
})
164166
165-
const emit = defineEmits(['close'])
166-
const slots = useSlots()
167+
const emit = defineEmits<{
168+
/**
169+
* Emitted when the close button is clicked
170+
*/
171+
close: []
172+
}>()
173+
174+
const slots = defineSlots<{
175+
actions?: Slot
176+
default?: Slot
177+
icon?: Slot
178+
}>()
167179
168180
const canClose = computed(() => !props.noClose)
169181
const hasActions = () => Boolean(slots.actions?.())
@@ -173,9 +185,6 @@ const hasIcon = () => Boolean(props.iconPath || props.iconSvg || !!slots.icon?.(
173185
* Handle closing the chip (pressing the X-button)
174186
*/
175187
function onClose() {
176-
/**
177-
* Emitted when the close button is clicked
178-
*/
179188
emit('close')
180189
}
181190
</script>

0 commit comments

Comments
 (0)