Git Product home page Git Product logo

Comments (5)

mihaisevencode avatar mihaisevencode commented on August 17, 2024 10

@otatar For the time being, you can just create a tailwind-datepicker-react.d.ts file with the following content:

declare module 'tailwind-datepicker-react' {
  import { ReactElement } from 'react';

  interface ITheme {
    background: string;
    todayBtn: string;
    clearBtn: string;
    icons: string;
    text: string;
    disabledText: string;
    input: string;
    inputIcon: string;
    selected: string;
  }

  interface IIcons {
    prev: () => ReactElement;
    next: () => ReactElement;
  }

  export interface IOptions {
    title?: string;
    autoHide?: boolean;
    todayBtn?: boolean;
    todayBtnText?: string;
    clearBtn?: boolean;
    clearBtnText?: string;
    maxDate?: Date;
    minDate?: Date;
    theme?: ITheme;
    icons?: IIcons;
    datepickerClassNames?: string;
    defaultDate?: Date | null;
    language?: string;
    weekDays?: string[];
    disabledDates?: Date[];
    inputNameProp?: string;
    inputIdProp?: string;
    inputPlaceholderProp?: string;
    inputDateFormatProp?: Intl.DateTimeFormatOptions;
  }

  type DatepickerProps = {
    children?: ReactElement | ReactNode;
    options?: IOptions;
    onChange?: (date: Date) => void;
    show: boolean;
    setShow: (show: boolean) => void;
    classNames?: string;
    selectedDateState?: [Date, (date: Date) => void];
  }

  export default function Datepicker(props: DatepickerProps): ReactElement
}

from tailwind-datepicker-react.

OMikkel avatar OMikkel commented on August 17, 2024 1

So... I pulled the repo to take a look at it myself, and the reason why there's no declaration file generated is that the build:dts script fails with the following:

image

Now, I've checked the TypeScript repo and as per this issue, it looks like this type is only available in es2020. I've played around with changing the target to es2020, but that's causing even more issues:

image

The only easy way of fixing this I've found is just ts-ignoreing that line, which does emit declaration files. @OMikkel What do you reckon we should do in this case?

I will be pushing a new version where the ts error is ignored.
It is not really a huge deal ignoring that error since it obviously exists on the class Intl

from tailwind-datepicker-react.

mihaisevencode avatar mihaisevencode commented on August 17, 2024

I was just about to post the same issue 👍

from tailwind-datepicker-react.

mihaisevencode avatar mihaisevencode commented on August 17, 2024

So... I pulled the repo to take a look at it myself, and the reason why there's no declaration file generated is that the build:dts script fails with the following:
image
Now, I've checked the TypeScript repo and as per this issue, it looks like this type is only available in es2020. I've played around with changing the target to es2020, but that's causing even more issues:
image
The only easy way of fixing this I've found is just ts-ignoreing that line, which does emit declaration files. @OMikkel What do you reckon we should do in this case?

from tailwind-datepicker-react.

nadamai avatar nadamai commented on August 17, 2024

The same issue here :/

from tailwind-datepicker-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.