Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Using new vue 3.4 is breaking the options typescript #288

@MLMdlb

Description

@MLMdlb
[X] Bug report => search github for a similar issue or PR before submitting
[ ] Feature request
[ ] Other, please describe

Tell about your platform

  • flatPickr version : 4.6.13
  • Vue.js version : 3.4.21
  • Browser name and version : Chrome
  • This package version : 11.0.5

Current behavior

Code snippet :

const pickerConfig = ref<flatpickr.Options.Options>({
  ...computedConfig.value,
  enableTime: typeof props?.others !== 'boolean' ? props?.others?.$comment?.includes('Time') : false,
  time_24hr: true,
  wrap: true,
  dateFormat: 'd/m/Y', 
})

error from tsc :

error TS2322: Type '{ allowInput?: boolean | undefined; allowInvalidPreload?: boolean | undefined; altFormat?: string | undefined; altInput?: boolean | undefined; altInputClass?: string | undefined; ... 56 more ...; wrap?: boolean | undefined; }' is not assignable to type 'Partial<BaseOptions>'.

79     <flat-pickr v-model="date" :config="pickerConfig" />
                                  ~~~~~~~
vue-flatpickr-component/dist/types/component.d.ts:85:5
    85     config: Partial<import("flatpickr/dist/types/options").BaseOptions>;
           ~~~~~~
    The expected type comes from property 'config' which is declared here on type 'Partial<{ config: Partial<BaseOptions>; events: HookKey[]; disabled: boolean; }> & Omit<{ readonly disabled: boolean; readonly modelValue: DateOption | DateOption[] | null; ... 15 more ...; "onOn-pre-calendar-position"?: ((...args: any[]) => any) | undefined; } & ... 4 more ... & { ...; }, "disabled" | ... 1 more .....'

Expected behavior
No bug

Minimal reproduction of the problem with instructions

<flat-pickr v-model="date" :config="pickerConfig" />

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions