mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
parent
4e081f6fc7
commit
32d0440d31
28
types/frecency/index.d.ts
vendored
Normal file
28
types/frecency/index.d.ts
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
// Type definitions for frecency 1.3
|
||||
// Project: https://github.com/mixmaxhq/frecency#readme
|
||||
// Definitions by: swyx <https://github.com/sw-yx>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
export type idAttrFn = (result: string) => string;
|
||||
export default class Frecency<T = any> {
|
||||
constructor(constructOpts: {
|
||||
key: string;
|
||||
idAttribute?: string | idAttrFn;
|
||||
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;
|
||||
}) => Array<T & { _frecencyScore?: number }>);
|
||||
}
|
||||
16
types/frecency/tsconfig.json
Normal file
16
types/frecency/tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts"]
|
||||
}
|
||||
1
types/frecency/tslint.json
Normal file
1
types/frecency/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user