Skip to content

Commit 2e60bee

Browse files
committed
fix(ts): export FuseIndex type
Export FuseIndex type in the namespace. Fixes #519
1 parent 8882044 commit 2e60bee

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

src/index.d.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ declare class Fuse<T> {
55
constructor(
66
list: ReadonlyArray<T>,
77
options?: Fuse.IFuseOptions<T>,
8-
index?: FuseIndex<T>
8+
index?: Fuse.FuseIndex<T>
99
)
1010
/**
1111
* Search function for the Fuse instance.
@@ -25,12 +25,12 @@ declare class Fuse<T> {
2525
* @param options `Fuse.FuseSearchOptions`
2626
* @returns An array of search results
2727
*/
28-
search<R = T>(
28+
search<T>(
2929
pattern: string | Fuse.Expression,
3030
options?: Fuse.FuseSearchOptions
31-
): Fuse.FuseResult<R>[]
31+
): Fuse.FuseResult<T>[]
3232

33-
setCollection(docs: ReadonlyArray<T>, index?: FuseIndex<T>): void
33+
setCollection(docs: ReadonlyArray<T>, index?: Fuse.FuseIndex<T>): void
3434

3535
/**
3636
* Adds a doc to the end the list.
@@ -52,7 +52,7 @@ declare class Fuse<T> {
5252
/**
5353
* Returns the generated Fuse index
5454
*/
55-
getIndex(): FuseIndex<T>
55+
getIndex(): Fuse.FuseIndex<T>
5656

5757
/**
5858
* Return the current version.
@@ -89,28 +89,28 @@ declare class Fuse<T> {
8989
keys: Array<Fuse.FuseOptionKey>,
9090
list: ReadonlyArray<U>,
9191
options?: Fuse.FuseIndexOptions<U>
92-
): FuseIndex<U>
92+
): Fuse.FuseIndex<U>
9393

9494
static parseIndex<U>(
9595
index: any,
9696
options?: Fuse.FuseIndexOptions<U>
97-
): FuseIndex<U>
97+
): Fuse.FuseIndex<U>
9898
}
9999

100-
declare class FuseIndex<T> {
101-
constructor(options?: Fuse.FuseIndexOptions<T>)
102-
setSources(docs: ReadonlyArray<T>): void
103-
setKeys(keys: ReadonlyArray<string>): void
104-
setIndexRecords(records: Fuse.FuseIndexRecords): void
105-
create(): void
106-
add(doc: T): void
107-
toJSON(): {
108-
keys: ReadonlyArray<string>
109-
collection: Fuse.FuseIndexRecords
100+
declare namespace Fuse {
101+
export class FuseIndex<T> {
102+
constructor(options?: FuseIndexOptions<T>)
103+
setSources(docs: ReadonlyArray<T>): void
104+
setKeys(keys: ReadonlyArray<string>): void
105+
setIndexRecords(records: FuseIndexRecords): void
106+
create(): void
107+
add(doc: T): void
108+
toJSON(): {
109+
keys: ReadonlyArray<string>
110+
collection: FuseIndexRecords
111+
}
110112
}
111-
}
112113

113-
declare namespace Fuse {
114114
type FuseGetFunction<T> = (
115115
obj: T,
116116
path: string | string[]

0 commit comments

Comments
 (0)