nathanreyes / v-calendar

An elegant calendar and datepicker plugin for Vue.
https://vcalendar.io
MIT License
4.32k stars 840 forks source link

fix: Allow attribute properties to be optional #1362

Closed abaumg closed 10 months ago

abaumg commented 10 months ago

When passing :select-attribute or :drag-attribute properties, TypeScript complains about missing properties.

Example from the docs:

<template>
  <VDatePicker v-model="date" :select-attribute="selectAttribute" />
</template>

<script setup>
import { ref } from 'vue';

const date = ref(new Date());
const selectAttribute = ref({ dot: true });
</script>

TypeScript complains about missing properties:

Type '{ dot: boolean; }' is missing the following properties from type 'AttributeConfig': key, hashcode, content, highlight, and 7 more.

This PR makes all AttributeConfig properties optional (by using TS's Partial<> utility type) and fixes the above type error.

nathanreyes commented 10 months ago

Good catch. Thanks for the contribution.