meilisearch/meilisearch-js

`MatchingStrategies` type issues

flevi29 opened this issue · 1 comments

I know this might sound like nitpicking, but I am trying to contribute, and this does cause a little issue.
I see that the instantsearch plugin even went so far as to re-implement the native enum into a typescript enum.

export const MatchingStrategies = {
ALL: 'all',
LAST: 'last',
}
export type MatchingStrategies = typeof MatchingStrategies[keyof typeof MatchingStrategies]

Should be re-written to:

export const MatchingStrategies = { 
   ALL: 'all', 
   LAST: 'last', 
 } as const

// OR

export const MatchingStrategies = Object.freeze({ 
   ALL: 'all', 
   LAST: 'last', 
 })
  
 export type MatchingStrategies = typeof MatchingStrategies[keyof typeof MatchingStrategies]

Otherwise MatchingStrategies is just string.

Good idea! Feel free to implement it, we are open to review your PR 😄