rusackas commented on code in PR #37625:
URL: https://github.com/apache/superset/pull/37625#discussion_r2770119305
##########
superset-frontend/src/explore/actions/exploreActions.test.ts:
##########
@@ -199,8 +199,8 @@ describe('reducers', () => {
];
const newState = exploreReducer(
- mockedState,
- actions.setControlValue('metrics', updatedMetrics, []),
+ mockedState as any,
+ actions.setControlValue('metrics', updatedMetrics, []) as any,
Review Comment:
Same pattern throughout this test file — partial mock state objects are cast
with `as any` because the test doesn't construct a full
`ExploreState`/`RootState`. This is consistent with the partial mock pattern
across all test files in the migration. The casts are localized to where mock
data meets typed function signatures.
##########
superset-frontend/src/explore/components/controls/ViewQueryModal.tsx:
##########
@@ -60,7 +60,7 @@ const ViewQueryModal: FC<Props> = ({ latestQueryFormData })
=> {
resultType,
})
.then(({ json }) => {
- setResult(ensureIsArray(json.result));
+ setResult(ensureIsArray(json.result) as Result[]);
Review Comment:
`ensureIsArray` returns `unknown[]` when given an `unknown` input (from the
JSON response). The `as Result[]` cast narrows it to the expected type. This is
a standard pattern at API response boundaries where the runtime shape is known
but TypeScript can't infer it from the JSON type. A runtime validation (e.g.,
Zod schema) would be the proper solution but is beyond migration scope.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]