diff --git a/react-helmet/react-helmet-tests.tsx b/react-helmet/react-helmet-tests.tsx new file mode 100644 index 0000000000..c50bdf2e17 --- /dev/null +++ b/react-helmet/react-helmet-tests.tsx @@ -0,0 +1,41 @@ +/// +/// + +import * as React from 'react'; +import Helmet from 'react-helmet'; + + + +const head = Helmet.rewind(); +const html = ` + + + + ${ head.title.toString() } + ${ head.meta.toString() } + ${ head.link.toString() } + + +
+ // React stuff here +
+ + +`; + +function HTML() { + return ( + + + { head.title.toComponent() } + { head.meta.toComponent() } + { head.link.toComponent() } + + +
+ // React stuff here +
+ + + ); +} diff --git a/react-helmet/react-helmet.d.ts b/react-helmet/react-helmet.d.ts new file mode 100644 index 0000000000..8cae272f98 --- /dev/null +++ b/react-helmet/react-helmet.d.ts @@ -0,0 +1,39 @@ +// Type definitions for react-helmet +// Project: https://github.com/nfl/react-helmet +// Definitions by: Evan Bremer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module 'react-helmet' { + import { Component } from 'react'; + + interface HelmetProps { + title?: string; + titleTemplate?: string; + base?: any; + link?: Array; + meta?: Array; + script?: Array; + onChangeClientState?: (newState: any) => void; + } + + interface HelmetData { + title: HelmetDatum; + base: HelmetDatum; + link: HelmetDatum; + meta: HelmetDatum; + script: HelmetDatum; + } + + interface HelmetDatum { + toString(): string; + toComponent(): Component; + } + + class Helmet extends Component { + static rewind(): HelmetData + } + + export default Helmet; +}