diff --git a/types/react-highlight.js/index.d.ts b/types/react-highlight.js/index.d.ts new file mode 100644 index 0000000000..8e356d7176 --- /dev/null +++ b/types/react-highlight.js/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for react-highlight.js 1.0 +// Project: https://github.com/bvaughn/react-highlight.js +// Definitions by: Christian Murphy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { ComponentClass, ReactNode } from "react"; + +/** + * Props for a Highlight component. + */ +export interface HighlightProps { + /** + * Language name to use as a class to signal type to highlight.js. + */ + language: string; + + /** + * Content that will be highlighted + */ + children?: ReactNode; +} + +/** + * A lightweight React wrapper around the Highlight.js syntax highlighting library. + */ +declare const Highlight: ComponentClass; + +export default Highlight; diff --git a/types/react-highlight.js/react-highlight.js-tests.tsx b/types/react-highlight.js/react-highlight.js-tests.tsx new file mode 100644 index 0000000000..72b2c1c08d --- /dev/null +++ b/types/react-highlight.js/react-highlight.js-tests.tsx @@ -0,0 +1,9 @@ +import * as React from "react"; +import Highlight from "react-highlight.js"; + +export const _ = () => <> + + + `console.log("Hello, world!");` + +; diff --git a/types/react-highlight.js/tsconfig.json b/types/react-highlight.js/tsconfig.json new file mode 100644 index 0000000000..2569887b3b --- /dev/null +++ b/types/react-highlight.js/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "jsx": "react", + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-highlight.js-tests.tsx" + ] +} diff --git a/types/react-highlight.js/tslint.json b/types/react-highlight.js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-highlight.js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }