frecency icon indicating copy to clipboard operation
frecency copied to clipboard

typescript typings

Open swyxio opened this issue 5 years ago • 0 comments

i use TS so i figured i would share what i had. not perfect :)

declare module 'frecency' {
  export default class Frecency<T = any> {
    constructor(constructOpts: {
      key: string;
      idAttribute?: string | Function;
      timeStampsLimit?: number;
      recentSelectionsLimit?: number;
      storageProvider?: object;
      exactQueryMatchWeight?: number;
      subQueryMatchWeight?: number;
      recentSelectionsMatchWeight?: number;
    });
    save: (arg: { searchQuery: T; selectedId: string }) => void;
    sort:
      | ((arg: { searchQuery: T; searchResults: T[] }) => T[])
      | ((arg: {
          searchQuery: T;
          searchResults: T[];
          keepScores?: boolean;
        }) => (T & { _frecencyScore?: number })[]);
  }
}

swyxio avatar May 26 '19 00:05 swyxio