DefinitelyTyped/types/react-syntax-highlighter/react-syntax-highlighter-tests.tsx
2018-02-15 11:27:11 +01:00

22 lines
581 B
TypeScript

import * as React from "react";
import SyntaxHighlighter from "react-syntax-highlighter";
import { docco } from "react-syntax-highlighter/styles/hljs";
function highlighter(): JSX.Element {
const codeString: string = `class CPP {
private year: number;
public constructor(private version: string) {
this.year = Number(version.match(/.+\d+$/));
}
public version(): string {
return this.version;
}
}
`;
return (
<SyntaxHighlighter language="javascript" style={docco}>
{codeString}
</SyntaxHighlighter>
);
}