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

Warning when using with TypeScript #119

Open
nstuyvesant opened this issue May 29, 2021 · 4 comments
Open

Warning when using with TypeScript #119

nstuyvesant opened this issue May 29, 2021 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@nstuyvesant
Copy link

Getting...

Cannot find module 'svelte-calendar' or its corresponding type declarations
when importing it

  import Datepicker from 'svelte-calendar'

Didn't see an @types/svelte-calendar out there either. Any chance of some type definitions in the future?

@6eDesign
Copy link
Owner

6eDesign commented Jun 2, 2021

https://github.com/IBM/sveld

A coworker recommended this approach.

@6eDesign 6eDesign added enhancement New feature or request good first issue Good for newcomers labels Jun 2, 2021
@nstuyvesant
Copy link
Author

Allain Chain suggested:

import Datepicker from 'svelte-calendar/src/Components/Datepicker.svelte'

as a workaround. This worked for me though I would like to have proper types for the Datepicker.

This is what I started...

declare module 'svelte-calendar' {
  interface DatepickerProps
    extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap['div']> {
    format?: string
    start?: Date
    end?: Date
    selected?: Date
    dateChosen?: boolean
    trigger?: () => void
    selectableCallback?: () => void
    weekStart?: number
    daysOfWeek?: Array<string, string>
    monthsOfYear?: Array<string, string>
    style?: string
    buttonBackgroundColor?: string
    buttonBorderColor?: string
    buttonTextColor?: string
    highlightColor?: string
    dayBackgroundColor?: string
    dayTextColor?: string
    dayHighlightedBackgroundColor?: string
    dayHighlightedTextColor?: string
  }
  export class Datepicker extends SvelteComponentTyped<DatepickerProps> {}
}

@6eDesign
Copy link
Owner

I have rewritten this component using svelte kit and used svelte-kit package to publish the package along with various type files. I am not personally using typescript in my projects. Please try out the new v3 version of this component library and let me know if this issue can be closed.

@6eDesign 6eDesign reopened this Sep 19, 2021
@6eDesign
Copy link
Owner

oops - didn't mean to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants