jest-styled-components
jest-styled-components copied to clipboard
top-level styleSheetSerializer export erases toHaveStyleSheet TypeScript definition
The fix from issue #259 turned index.d.ts from a global file to a module. This erases visibility to the declare namespace jest code and visibility to toHaveStyleSheet. Because of this, TS projects fail to compile in development mode.
I fear a breaking change is required, to remove the export from top-level jest-styled-components and require users needing the serializer to get it from the source in jest-styled-components/serializer.
Any other suggestions? The separation works, because jest-styled-components/serializer can have its own index.d.ts file set up as a module. Anyone who took advantage of importing from the top-level module can change their code to import from the serializer subdirectory.
But it is a breaking change.
This change would also fix issue #291.
I have also this issue - I had to download the d.ts to my local code and point in tsconfig:
"jest-styled-components": ["types/jest-styled-components.d.ts"] and remove the line:
export declare const styleSheetSerializer: Exclude<Plugin, NewPlugin>; in order for it to work