Skip to content

Instantly share code, notes, and snippets.

@chaance
Last active May 5, 2020 15:59
Show Gist options
  • Save chaance/6b7837b1f6341eac740eed38d5b85c3e to your computer and use it in GitHub Desktop.
Save chaance/6b7837b1f6341eac740eed38d5b85c3e to your computer and use it in GitHub Desktop.
Overriding the default theme types in Emotion 11
// this goes in you root types directory, filename is the [name-of-your-module].d.ts
import '@emotion/react';
import { MyCustomTheme } from './theme';
declare module '@emotion/react' {
export interface Theme extends MyCustomTheme {}
}
export type ThemeColorScheme = {
primary: string;
background: {
body: string;
};
text: {
body: string;
};
};
export type MyCustomTheme = {
colors: ThemeColorScheme;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment