Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeScript] Make types more strict in ra-core #9741

Merged
merged 9 commits into from
Mar 25, 2024
Merged

Conversation

fzaninotto
Copy link
Member

@fzaninotto fzaninotto commented Mar 22, 2024

With strictNullChecks turned on, this PR reduces TS compilation errors on ra-core from 246 to 180 (-26%).

Refs #9622
Follows #9644, #9743

@fzaninotto fzaninotto changed the title [TypeScript] Make hooks in core/dataProvider use stricter types [TypeScript] Make types stricter in ra-core Mar 22, 2024
@fzaninotto fzaninotto changed the title [TypeScript] Make types stricter in ra-core [TypeScript] Make types more strict in ra-core Mar 22, 2024
@@ -1,6 +1,6 @@
import { createContext, useContext } from 'react';

export const HasDashboardContext = createContext<boolean>(undefined);
export const HasDashboardContext = createContext<boolean>(false);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you change the type instead and make useHasDashboard fail loudly (https://blog.codeminer42.com/you-are-using-react-context-wrong/)?

Comment on lines +465 to +469
onSuccess?: (
data: RecordType | undefined,
variables: Partial<UseDeleteMutateParams<RecordType>>,
context: unknown
) => void;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get this one. Doesn't UseMutationOptions already include onSuccess?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants