Created
September 10, 2019 01:31
-
-
Save alangpierce/20829c644b1fc179e049d26b51e12e49 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
type Template<T> = (args: T) => string; | |
export function makeJadeTransitionShim<T>(jadeTemplate: Template<T>, Component: React.ComponentType<T>): Template<T> { | |
return (args: T) => { | |
const jadeResult = jadeTemplate(args); | |
const reactResult = ReactDOMServer.renderToStaticMarkup(<Component {...args} />); | |
assert(jadeResult === reactResult, 'Results not equal!'); | |
return jadeResult; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment