TinySort icon indicating copy to clipboard operation
TinySort copied to clipboard

TypeScript d.ts file for TinySort?

Open daiplusplus opened this issue 6 years ago • 2 comments

Would it be possible to get a TypeScript d.ts file for TinySort?

daiplusplus avatar Apr 05 '18 00:04 daiplusplus

I currently don't have the time to figure out how to write a proper Typescript definition file but I'd welcome a pull request. Tinysort does have thorough JSDoc declarations so it shouldn't be too hard if you know how to.

Sjeiti avatar Apr 13 '18 14:04 Sjeiti

Started work on this, not sure if it's complete but got we what I needed in my app. Might be useful for someone to complete?

declare module 'tinysort' {
  export interface Options {
    selector?: string;
    order?: 'asc' | 'desc' | 'rand';
    attr?: string;
    data?: string;
    place?: 'start' | 'end' | 'first' | 'last' | 'org';
    useVal?: boolean;
    cases?: boolean;
    natural?: boolean;
    forceStrings?: boolean;
    ignoreDashes?: boolean;
    sortFunction?(el: HTMLElement): function;
    useFlex?: boolean;
    emptyEnd?: boolean;
    console?: boolean;
  }

  export default function tinysort(
    nodelist: string | NodeList | JQuery<HTMLElement>,
    options?: Options
  );
}

ChrisSargent avatar Apr 04 '20 09:04 ChrisSargent