suddjian edited a comment on pull request #14120:
URL: https://github.com/apache/superset/pull/14120#issuecomment-838992667


   I think I see what's going on with that typing issue. Typescript is 
inferring a type for the temporary array that is broader than the `Filter` 
type. In the inferred type, `input` is a string, instead of the stricter set of 
valid strings specified by `Filter`. To fix this and keep type safety, I 
suggest extracting the favorite filter into its own variable that is explicitly 
typed, by doing:
   
   ```
   const favoritesFilter: Filter = {
     Header: t('Favorite'),
     id: 'id',
     urlDisplay: 'favorite',
     input: 'select',
     operator: FilterOperator.dashboardIsFav,
     unfilteredLabel: t('Any'),
     selects: [
       { label: t('Yes'), value: true },
       { label: t('No'), value: false },
     ],
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to