Copilot commented on code in PR #35993:
URL: https://github.com/apache/superset/pull/35993#discussion_r2496418175
##########
superset-frontend/src/explore/components/controls/DatasourceControl/DatasourceControl.test.tsx:
##########
@@ -377,7 +398,9 @@ test('should set the default temporal column', async () => {
useRouter: true,
});
- await openAndSaveChanges(overrideProps.datasource);
+ await openAndSaveChanges(
+ overrideProps.datasource as unknown as Partial<DatasetObject>,
+ );
Review Comment:
Using `as unknown as Partial<DatasetObject>` is a double type assertion
anti-pattern that bypasses type safety. Consider updating the mock datasource
object structure to match `Partial<DatasetObject>` or refine the type
definition of `openAndSaveChanges` to accept a more flexible type like
`JsonObject`.
##########
superset-frontend/src/explore/components/controls/DatasourceControl/DatasourceControl.test.tsx:
##########
@@ -413,7 +436,9 @@ test('should set the first available temporal column',
async () => {
useRouter: true,
});
- await openAndSaveChanges(overrideProps.datasource);
+ await openAndSaveChanges(
+ overrideProps.datasource as unknown as Partial<DatasetObject>,
+ );
Review Comment:
Using `as unknown as Partial<DatasetObject>` is a double type assertion
anti-pattern that bypasses type safety. Consider updating the mock datasource
object structure to match `Partial<DatasetObject>` or refine the type
definition of `openAndSaveChanges` to accept a more flexible type like
`JsonObject`.
##########
superset-frontend/src/explore/components/controls/DatasourceControl/DatasourceControl.test.tsx:
##########
@@ -449,7 +474,9 @@ test('should not set the temporal column', async () => {
useRouter: true,
});
- await openAndSaveChanges(overrideProps.datasource);
+ await openAndSaveChanges(
+ overrideProps.datasource as unknown as Partial<DatasetObject>,
+ );
Review Comment:
Using `as unknown as Partial<DatasetObject>` is a double type assertion
anti-pattern that bypasses type safety. Consider updating the mock datasource
object structure to match `Partial<DatasetObject>` or refine the type
definition of `openAndSaveChanges` to accept a more flexible type like
`JsonObject`.
```suggestion
const mockDatasource: Partial<DatasetObject> = overrideProps.datasource;
await openAndSaveChanges(mockDatasource);
```
--
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]