Adding type definitions for project
Opened this issue · 5 comments
iammerus commented
Trying to use this project in a typescript project will fail because it doesn't have type definitions.
deitch commented
PRs definitely welcome.
iammerus commented
Added a PR to DefinitelyTyped
deitch commented
Awesome thanks!
taylorjdawson commented
@iammerus Hey so would it be possible to add types for the searchjs filters?
taylorjdawson commented
Here is what I came up:
interface FilterRange {
from?: number
to?: number
gt?: number
lt?: number
gte?: number
lte?: number
}
interface Primative {
[key: string]: string | number | Date | string[] | number[] | boolean | FilterRange | undefined
}
interface Modifier {
_propertySearch?: boolean
_propertySearchDepth?: number
_join?: "OR" | "AND"
_not?: boolean
_text?: boolean
_word?: boolean
_start?: boolean
_end?: boolean
_regexp?: boolean
_separator?: string
terms?: Filter[]
}
type Filter = Primative | Modifier
Let me know if you want me to add these