jjranalli / nightwind

An automatic, customisable, overridable Tailwind dark mode plugin
https://nightwindcss.com
MIT License
719 stars 45 forks source link

add TypeScript types #74

Open milan-gm opened 1 year ago

milan-gm commented 1 year ago

Screenshot_20230530_095917

paulglx commented 1 year ago

Hey, I got the same exact error after installing.

bbonamin commented 1 year ago

To get around this issue you can add custom types to your project, e.g. at nightwind-helper.d.ts:

declare module "nightwind/helper" {
  type NightwindHelperModule = {
    init: () => string;
    beforeTransition: () => void;
    toggle: () => void;
    enable: (dark: boolean) => void;
    checkNightMode: () => boolean;
    watchNightMode: () => void;
    addNightModeSelector: () => void;
    addNightTransitions: () => void;
    initNightwind: () => void;
    toggleNightMode: () => void;
  };

  const nightwindHelper: NightwindHelperModule;

  export default nightwindHelper;
}
CommanderStorm commented 3 months ago

FYI: @types/nightwind is now avaliable. You can install it via

npm install --save-dev @types/nightwind