Created
October 2, 2020 05:46
-
-
Save gyng/30d8da10ed1064a0ee900d70aec85c4e to your computer and use it in GitHub Desktop.
SVGR TypeScript + Jest definitions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module "*.svg" { | |
import * as React from "react"; | |
const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>; | |
export { ReactComponent }; | |
export default ReactComponent; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
...otherStuff, | |
moduleNameMapper: { | |
// .svg should have high priority | |
"\\.svg$": "<rootDir>/test/helpers/svgrMock.js", | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default "svg"; | |
export const ReactComponent = "svg"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MySvg from "mysvg.svg"; | |
const MyComponent = () => <MySvg />; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment