Start tackling strict null

This commit is contained in:
Manav Rathi 2024-05-25 07:29:50 +05:30
parent 94c1cc011b
commit 431d629641
No known key found for this signature in database
2 changed files with 24 additions and 22 deletions

View file

@ -14,7 +14,7 @@
"jsxImportSource": "@emotion/react",
"strict": true,
"strictNullChecks": false,
"strictNullChecks": true,
/* Stricter than strict */
"noImplicitReturns": true,
"noUnusedParameters": true,

View file

@ -1,5 +1,6 @@
import type { PaletteOptions, ThemeColorsOptions } from "@mui/material";
import { THEME_COLOR } from "../constants";
import { ensure } from "@/utils/ensure";
export const getPallette = (
themeColor: THEME_COLOR,
@ -20,38 +21,39 @@ export const getPalletteOptions = (
): PaletteOptions => {
return {
primary: {
main: colors.fill.base,
dark: colors.fill.basePressed,
// TODO: Refactor this code to not require this ensure
main: ensure(colors.fill?.base),
dark: colors.fill?.basePressed,
contrastText:
themeColor === "dark" ? colors.black.base : colors.white.base,
themeColor === "dark" ? colors.black?.base : colors.white?.base,
},
secondary: {
main: colors.fill.faint,
dark: colors.fill.faintPressed,
contrastText: colors.text.base,
main: ensure(colors.fill?.faint),
dark: colors.fill?.faintPressed,
contrastText: colors.text?.base,
},
accent: {
main: colors.accent.A500,
dark: colors.accent.A700,
contrastText: colors.white.base,
main: ensure(colors.accent?.A500),
dark: colors.accent?.A700,
contrastText: colors.white?.base,
},
critical: {
main: colors.danger.A700,
dark: colors.danger.A800,
contrastText: colors.white.base,
main: ensure(colors.danger?.A700),
dark: colors.danger?.A800,
contrastText: colors.white?.base,
},
background: {
default: colors.background.base,
paper: colors.background.elevated,
default: colors.background?.base,
paper: colors.background?.elevated,
},
text: {
primary: colors.text.base,
secondary: colors.text.muted,
disabled: colors.text.faint,
base: colors.text.base,
muted: colors.text.muted,
faint: colors.text.faint,
primary: colors.text?.base,
secondary: colors.text?.muted,
disabled: colors.text?.faint,
base: colors.text?.base,
muted: colors.text?.muted,
faint: colors.text?.faint,
},
divider: colors.stroke.faint,
divider: colors.stroke?.faint,
};
};