Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding type definitions for project #71

Open
iammerus opened this issue Mar 24, 2020 · 5 comments
Open

Adding type definitions for project #71

iammerus opened this issue Mar 24, 2020 · 5 comments

Comments

@iammerus
Copy link

Trying to use this project in a typescript project will fail because it doesn't have type definitions.

@deitch
Copy link
Owner

deitch commented Mar 24, 2020

PRs definitely welcome.

@iammerus
Copy link
Author

Added a PR to DefinitelyTyped

DefinitelyTyped/DefinitelyTyped#43370

@deitch
Copy link
Owner

deitch commented Mar 25, 2020

Awesome thanks!

@taylorjdawson
Copy link

@iammerus Hey so would it be possible to add types for the searchjs filters?

@taylorjdawson
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants