Stricter TS, matches counter

This commit is contained in:
Simon Cambier
2022-04-16 23:48:08 +02:00
parent 43b617e2af
commit f4c3656194
8 changed files with 68 additions and 75 deletions

View File

@@ -22,17 +22,18 @@ export type IndexedNote = {
export type SearchMatch = {
match: string
index: number
offset: number
}
export const isSearchMatch = (o: { index?: number }): o is SearchMatch => {
return o.index !== undefined
export const isSearchMatch = (o: { offset?: number }): o is SearchMatch => {
return o.offset !== undefined
}
export type ResultNote = {
searchResult: SearchResult
// searchResult: SearchResult
path: string
basename: string
content: string
foundWords: string[]
matches: SearchMatch[]
occurence: number
}