Skip to content

Instantly share code, notes, and snippets.

@alangpierce
Created September 10, 2019 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alangpierce/20829c644b1fc179e049d26b51e12e49 to your computer and use it in GitHub Desktop.
Save alangpierce/20829c644b1fc179e049d26b51e12e49 to your computer and use it in GitHub Desktop.
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