meilisearch / meilisearch-js

JavaScript client for the Meilisearch API

Home Page:https://www.meilisearch.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`MatchingStrategies` type issues

flevi29 opened this issue · 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 😄