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

bug: calendar date builder not compatible with type Builder for render delegation #199

Closed
ollema opened this issue Dec 4, 2023 · 2 comments · Fixed by #201
Closed

bug: calendar date builder not compatible with type Builder for render delegation #199

ollema opened this issue Dec 4, 2023 · 2 comments · Fixed by #201

Comments

@ollema
Copy link
Contributor

ollema commented Dec 4, 2023

mentioned here: #184 (comment)

will take a look at the builder attrs, its likely because the attributes are as const which should be a simple fix.

...
{#each weekDates as date}
  <Calendar.Cell {date} class="!important p-0">
    <Calendar.Date asChild let:builder let:disabled {date} month={month.value}>
      <LaundryDate
        {date}
        {disabled}
        reservations={data.reservations[date.toString()]}
        apartment={data.apartment}
        builders={[builder]}
      />
    </Calendar.Date>
  </Calendar.Cell>
{/each}
...

where:

<!-- LaundryDate.svelte -->
<script lang="ts">
	import Timeslot from './Timeslot.svelte';
	import { isToday, type DateValue } from '@internationalized/date';
	import { timeslots } from './timeslots';
	import type { SerializableReservationMap } from './types';
	import { builderActions, getAttrs, type Builder } from 'bits-ui';

	export let date: DateValue;
	export let disabled: boolean;
	export let reservations: SerializableReservationMap | undefined;
	export let apartment: string | undefined;
	export let builders: Builder[] = [];

	$: today = isToday(date, 'Europe/Stockholm');
</script>
...

gives:

❯ pnpm check

> skiftesgatan@0.0.1 check /Users/s0001325/repos/skiftesgatan
> svelte-kit sync && svelte-check --tsconfig ./tsconfig.json


====================================
Loading svelte-check in workspace: /Users/s0001325/repos/skiftesgatan
Getting Svelte diagnostics...


 (x2)
 (x3)
 (x4)
/Users/s0001325/repos/skiftesgatan/src/routes/laundry/calendar/+page.svelte:88:22
Error: Type '((cellValue: DateValue, monthValue: DateValue) => { readonly role: "button"; readonly 'aria-label': string; readonly 'aria-selected': true | undefined; readonly 'aria-disabled': true | undefined; ... 8 more ...; readonly tabindex: 0 | ... 1 more ... | undefined; }) & { ...; } & { ...; }' is not assignable to type 'Builder'.
  Index signature for type 'string' is missing in type '((cellValue: DateValue, monthValue: DateValue) => { readonly role: "button"; readonly 'aria-label': string; readonly 'aria-selected': true | undefined; readonly 'aria-disabled': true | undefined; ... 8 more ...; readonly tabindex: 0 | ... 1 more ... | undefined; }) & { ...; } & { ...; }'. (ts)
                                                                                apartment={data.apartment}
                                                                                builders={[builder]}
                                                                        />


====================================
svelte-check found 1 error and 0 warnings in 1 file
 ELIFECYCLE  Command failed with exit code 1.
@huntabyte
Copy link
Owner

I checked the types and everything seemed fine so I thought it was addressed! Will investigate now!

@huntabyte
Copy link
Owner

Closed by #201

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants