You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/05/11 21:38:21 UTC
[GitHub] [superset] suddjian edited a comment on pull request #14120: fix: do not render favorite favStars and filters for anonymous user
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org