mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 23:37:04 +00:00
react-helmet-async: Provides its own types (#39509)
This commit is contained in:
committed by
Jesse Trinity
parent
160bc540b5
commit
d12b4cf567
@@ -3324,6 +3324,12 @@
|
||||
"sourceRepoURL": "https://github.com/react-ga/react-ga",
|
||||
"asOfVersion": "2.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "react-helmet-async",
|
||||
"typingsPackageName": "react-helmet-async",
|
||||
"sourceRepoURL": "https://github.com/staylor/react-helmet-async",
|
||||
"asOfVersion": "1.0.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "react-i18next",
|
||||
"typingsPackageName": "react-i18next",
|
||||
|
||||
Vendored
-23
@@ -1,23 +0,0 @@
|
||||
// Type definitions for react-helmet-async 1.0
|
||||
// Project: https://github.com/staylor/react-helmet-async
|
||||
// Definitions by: forabi <https://github.com/forabi>
|
||||
// dobesv <https://github.com/dobesv>
|
||||
// Daniel Perez Alvarez <https://github.com/unindented>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
import { Helmet, HelmetData } from 'react-helmet';
|
||||
|
||||
export { Helmet, HelmetData };
|
||||
|
||||
export interface PopulatedContext {
|
||||
helmet: HelmetData;
|
||||
}
|
||||
|
||||
interface ProviderProps {
|
||||
context?: {};
|
||||
}
|
||||
|
||||
export class HelmetProvider extends React.Component<ProviderProps> {}
|
||||
@@ -1,38 +0,0 @@
|
||||
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 App1 = () => (
|
||||
<HelmetProvider>
|
||||
<div>
|
||||
<Helmet>
|
||||
<title>Hello World</title>
|
||||
<link rel="canonical" href="https://www.example.com/" />
|
||||
</Helmet>
|
||||
<h1>Hello World</h1>
|
||||
</div>
|
||||
</HelmetProvider>
|
||||
);
|
||||
|
||||
ReactDOM.render(<App1 />, document.getElementById("root"));
|
||||
|
||||
const helmetContext = {};
|
||||
|
||||
const App2 = () => (
|
||||
<HelmetProvider context={helmetContext}>
|
||||
<div>
|
||||
<Helmet>
|
||||
<title>Hello World</title>
|
||||
<link rel="canonical" href="https://www.tacobell.com/" />
|
||||
</Helmet>
|
||||
<h1>Hello World</h1>
|
||||
</div>
|
||||
</HelmetProvider>
|
||||
);
|
||||
|
||||
const html = renderToString(<App2 />);
|
||||
console.log(html);
|
||||
|
||||
const { helmet } = helmetContext as PopulatedContext;
|
||||
console.log(helmet);
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["dom", "es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"jsx": "react",
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "react-helmet-async-tests.tsx"]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user