buzinas / simple-scrollbar

Very simple and lightweight vanilla javascript library for creating a custom scrollbar cross-browser.
MIT License
575 stars 159 forks source link

Add declaration files for TS or @types/simple-scrollbar #50

Closed Beraliv closed 4 years ago

Beraliv commented 6 years ago

While adding import to TS file

import SimpleScrollBar from 'simple-scrollbar';

The error is shown:

screen shot 2018-10-02 at 12 28 45

It would solve the problem

Beraliv commented 6 years ago

Steps to add types:

  1. add link in package.json:
{
  "types": "./types.d.ts",
}
  1. add file in root with respective types:
declare namespace SimpleScrollBar {
    export function initEl (element: Element): void;
    export function initAll (): void;
    export function moveBar (e: Event): void;
}

export default SimpleScrollBar

UPDATE I checked it already and I advised wrong types.d.ts Need to fix them

I will add PR soon

Beraliv commented 6 years ago

I've added types in PR#51 and need to check if they're correct

ghost commented 4 years ago

@Beraliv Also this. declare module "simple-scrollbar";

buzinas commented 4 years ago

This was fixed by #51.