diff --git a/types/react-helmet-async/index.d.ts b/types/react-helmet-async/index.d.ts index 507872533f..9069549868 100644 --- a/types/react-helmet-async/index.d.ts +++ b/types/react-helmet-async/index.d.ts @@ -1,13 +1,14 @@ -// Type definitions for react-helmet-async 0.0 -// Project: https://github.com/staylor/react-helmet-async#readme, https://github.com/nytimes/react-helmet-async +// Type definitions for react-helmet-async 1.0 +// Project: https://github.com/staylor/react-helmet-async, https://github.com/nytimes/react-helmet-async // Definitions by: forabi +// Daniel Perez Alvarez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -import * as React from 'react'; +import * as React from "react"; +import { HelmetData } from "react-helmet"; -import Helmet, { HelmetData } from 'react-helmet'; -export default Helmet; +export { default as Helmet } from "react-helmet"; export interface PopulatedContext { helmet: HelmetData; diff --git a/types/react-helmet-async/react-helmet-async-tests.tsx b/types/react-helmet-async/react-helmet-async-tests.tsx index e91f437edc..2a1aff1785 100644 --- a/types/react-helmet-async/react-helmet-async-tests.tsx +++ b/types/react-helmet-async/react-helmet-async-tests.tsx @@ -1,15 +1,38 @@ -import * as React from 'react'; -import { renderToString } from 'react-dom/server'; -import Helmet, { HelmetProvider, PopulatedContext } from 'react-helmet-async'; +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import { renderToString } from "react-dom/server"; +import { Helmet, HelmetProvider, PopulatedContext } from "react-helmet-async"; -const helmetContext = {}; - -const markup = renderToString( - +const App1 = () => ( +
- Hello, world! + Hello World + +

Hello World

); + +ReactDOM.render(, document.getElementById("root")); + +const helmetContext = {}; + +const App2 = () => ( + +
+ + Hello World + + +

Hello World

+
+
+); + +const html = renderToString(); +console.log(html); + +const { helmet } = helmetContext as PopulatedContext; +console.log(helmet); diff --git a/types/react-helmet-async/tsconfig.json b/types/react-helmet-async/tsconfig.json index bbd3f732ac..f798797bb0 100644 --- a/types/react-helmet-async/tsconfig.json +++ b/types/react-helmet-async/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6"], + "lib": ["dom", "es6"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true,