I have a monorepo of react components that are built using styled-components, getting their themes from a theme provider.
declare module 'styled-components' {
export interface DefaultTheme {
colours: Colours;
spacing: Spacing;
breakpoints: Breakpoints;
}
}
The above currently lives in my root types folder <root>/types/styled.d.ts
However, I have about 20 component packages, and growing.
When I include the above file in my components src directory, my intellisense works.
<root>/components/[component name]/src/[src files + styled.d.ts]
However, including the same file in every single package seems overkill?
Is there a way, maybe using tsconfig? To tell my package to use the above module from my root types folder instead?
Thanks!
Edit:
I've updated my files to import like so:
import '@common-types/styled';
This works as expected - Is the the right way to do this?