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

Using new vue 3.4 is breaking the options typescript #288

Open
MLMdlb opened this issue Mar 11, 2024 · 1 comment
Open

Using new vue 3.4 is breaking the options typescript #288

MLMdlb opened this issue Mar 11, 2024 · 1 comment

Comments

@MLMdlb
Copy link

MLMdlb commented Mar 11, 2024

[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" />

@ankurk91
Copy link
Owner

Please share a minimal re-production on platforms like https://codesandbox.io/

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

No branches or pull requests

2 participants