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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

colors object type safe using satisfies #1017

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -83,7 +83,7 @@
"scaffdog": "2.4.0",
"styled-components": "5.3.5",
"ts-jest": "28.0.4",
"typescript": "4.8.2"
"typescript": "4.9.3"
},
"files": [
"dist"
Expand Down
28 changes: 14 additions & 14 deletions src/styles/color.ts
@@ -1,19 +1,19 @@
export type Color = {
40?: string; // TODO: Abolish this key or define all colors with this key
50?: string; // TODO: Abolish this key or define all colors with this key
100: string;
200: string;
300: string;
400: string;
500: string;
600: string;
700: string;
800: string;
900: string;
1000?: string; // TODO: Abolish this key or define all colors with this key
40?: `#${string}`;
50?: `#${string}`;
100: `#${string}`;
200: `#${string}`;
300: `#${string}`;
400: `#${string}`;
500: `#${string}`;
600: `#${string}`;
700: `#${string}`;
800: `#${string}`;
900: `#${string}`;
1000?: `#${string}`;
};

export const colors: { [color: string]: Color } = {
export const colors = {
red: {
100: "#FFE2E5",
200: "#FFBAC3",
Expand Down Expand Up @@ -76,4 +76,4 @@ export const colors: { [color: string]: Color } = {

1000: "#001326",
},
};
} satisfies Record<string, Color>;
6 changes: 3 additions & 3 deletions src/themes/palette.ts
Expand Up @@ -52,7 +52,7 @@ export type Palette = {
};

export const palette: Palette = {
white: colors.basic[50] as string, // TODO
white: colors.basic[50],
black: colors.basic[900],
primary: {
deepDark: colors.blue[700],
Expand Down Expand Up @@ -98,9 +98,9 @@ export const palette: Palette = {
},
background: {
default: "#FFFFFF",
dark: colors.blue[40] as string, // TODO
dark: colors.blue[40],
active: colors.blue[100],
hint: colors.blue[50] as string, // TODO
hint: colors.blue[50],
},
divider: colors.basic[400],
icon: {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -14883,10 +14883,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==

typescript@4.8.2:
version "4.8.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.2.tgz#e3b33d5ccfb5914e4eeab6699cf208adee3fd790"
integrity sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==
typescript@4.9.3:
version "4.9.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.3.tgz#3aea307c1746b8c384435d8ac36b8a2e580d85db"
integrity sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==

uglify-js@^3.1.4:
version "3.16.0"
Expand Down