Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar: Incorrect TypeScript typing of date slot #2703

Closed
James-Laidlaw opened this issue Jun 21, 2022 · 2 comments
Closed

Calendar: Incorrect TypeScript typing of date slot #2703

James-Laidlaw opened this issue Jun 21, 2022 · 2 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@James-Laidlaw
Copy link
Contributor

Describe the bug

The date slotprop of the calendar is incorrectly typed as

type CalendarValueType = Date | Date[] | undefined;

when the documentation and behavior suggests it is a date representation metadata object with a structure looking more like
{ day: number; month: number; year: number; today: boolean; selectable: boolean }

this causes typescript to throw errors when you use it as intended.

Reproducer

No response

PrimeVue version

3.15.0

Vue version

3.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

  1. make a calendar

  2. attempt to format it something like this

  <Calendar :inline="true" class="testing123">
    <template #date="slotProps">
      {{ slotProps.date?.day }}
    </template>
  </Calendar>
  1. observe typescript throwing errors about it being typed as
    Date | Date[] | undefined

Expected behavior

date slot prop should be typed correctly for its structure

@James-Laidlaw James-Laidlaw added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Jun 21, 2022
@James-Laidlaw
Copy link
Contributor Author

currently working on a fix

@tugcekucukoglu tugcekucukoglu changed the title Component: Calendar. TypeScript incorrect typing of date slot prop Calendar: Incorrect TypeScript typing of date slot Jun 28, 2022
@tugcekucukoglu tugcekucukoglu added this to the 3.15.1 milestone Jun 28, 2022
@tugcekucukoglu tugcekucukoglu self-assigned this Jun 28, 2022
@tugcekucukoglu
Copy link
Member

Fixed via #2704

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

2 participants