Skip to content

Commit 9dda17d

Browse files
committed
chore: react-admin type fixes Refs: KK-1543
1 parent 8b1bd1f commit 9dda17d

3 files changed

Lines changed: 10 additions & 13 deletions

File tree

src/common/materialUI/themeConfig.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { createTheme } from '@mui/material';
22
import { defaultTheme } from 'react-admin';
33

4+
// RA5's defaultTheme.shape.borderRadius is typed `string | number` but MUI's
5+
// createTheme expects `number`. Cast is unavoidable until RA narrows the type.
6+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
47
const theme = createTheme({
5-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
68
...(defaultTheme as any),
79
palette: {
8-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
9-
...(defaultTheme.palette as any),
10+
...defaultTheme.palette,
1011
primary: {
1112
main: '#0072c6', // hds-brand-color-coat-of-arms-blue
1213
},

src/domain/application/App.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const App = () => {
4242
dataProvider={dataProvider as DataProvider}
4343
i18nProvider={i18nProvider}
4444
theme={theme}
45+
darkTheme={null}
4546
dashboard={Dashboard}
4647
authProvider={authProvider}
4748
>
@@ -108,7 +109,7 @@ export function getReactAdminResources(
108109
projectId?: string,
109110
permissions?: Permissions
110111
): ResourceProps[] {
111-
const resources = [
112+
const resources: ResourceProps[] = [
112113
{
113114
name: 'events-and-event-groups',
114115
options: { label: 'events.list.title' },
@@ -161,10 +162,7 @@ export function getReactAdminResources(
161162
icon: ChildCareIcon,
162163
list: ChildResource.List,
163164
show: ChildResource.Detail,
164-
// Use `any` to avoid type error for edit and create,
165-
// which should allow undefined, but for some reason does not.
166-
// eslint-disable-line @typescript-eslint/no-explicit-any
167-
} as any);
165+
});
168166
}
169167
return resources;
170168
}

src/index.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ if (import.meta.env.VITE_SENTRY_DSN) {
3434
const container = document.getElementById('root');
3535
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3636
const root = createRoot(container!, {
37-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
38-
onCaughtError: (error: unknown, errorInfo: any) => {
37+
onCaughtError: (error: unknown, errorInfo: { componentStack?: string }) => {
3938
// eslint-disable-next-line no-console
4039
console.error(
4140
'[CAUGHT_ERROR] message:',
@@ -44,8 +43,7 @@ const root = createRoot(container!, {
4443
errorInfo?.componentStack
4544
);
4645
},
47-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
48-
onUncaughtError: (error: unknown, errorInfo: any) => {
46+
onUncaughtError: (error: unknown, errorInfo: { componentStack?: string }) => {
4947
// eslint-disable-next-line no-console
5048
console.error(
5149
'[UNCAUGHT_ERROR] message:',
@@ -54,7 +52,7 @@ const root = createRoot(container!, {
5452
errorInfo?.componentStack
5553
);
5654
},
57-
} as any);
55+
});
5856
root.render(<App />);
5957

6058
// If you want your app to work offline and load faster, you can change

0 commit comments

Comments
 (0)