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 2020/06/16 23:25:11 UTC

[GitHub] [incubator-superset] ktmud commented on a change in pull request #10068: chore: type src/dashboard/util/charts

ktmud commented on a change in pull request #10068:
URL: https://github.com/apache/incubator-superset/pull/10068#discussion_r441195944



##########
File path: superset-frontend/src/dashboard/util/charts/getFormDataWithExtraFilters.ts
##########
@@ -25,16 +25,24 @@ import getEffectiveExtraFilters from './getEffectiveExtraFilters';
 const cachedFiltersByChart = {};
 const cachedFormdataByChart = {};
 
+interface GetFormDataWithExtraFiltersArguments {
+  chart: Record<string, any>;

Review comment:
       I'm wondering whether `chart` matches any existing types? If not, can we create a new interface in `src/dashboard/types.ts` and slowly expand it?

##########
File path: superset-frontend/src/dashboard/util/charts/getEffectiveExtraFilters.ts
##########
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-export default function getEffectiveExtraFilters(filters) {
+export default function getEffectiveExtraFilters(filters: Record<string, any>) {

Review comment:
       There is `DataRecordFilters` in `@superset-ui/chart` that should match `filters` here. And it'd be good to also create an `ExtraFilter` type:
   
   ```ts
   import { DataRecordFilters, DataRecordValue } from "@superset-ui/chart";
   
   interface ExtraFilter {
     col: string;
     op: 'in' | 'eq' | ...,
     val: DataRecordValue[]
   }
   
   export default function getEffectiveExtraFilters(filters: DataRecordFilters): ExtraFilter[] {
   ```




----------------------------------------------------------------
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