[react-helmet] replace to HTMLHtmlElement from HTMLElement (#39161)

This commit is contained in:
Yamagishi Kazutoshi 2019-10-23 05:37:16 +09:00 committed by Wesley Wigham
parent 2631e23ba6
commit ec88d3924d
2 changed files with 17 additions and 4 deletions

View File

@ -1,11 +1,20 @@
// Type definitions for react-helmet 5.0
// Project: https://github.com/nfl/react-helmet
// Definitions by: Evan Bremer <https://github.com/evanbb>, Isman Usoh <https://github.com/isman-usoh>, François Nguyen <https://github.com/lith-light-g>, Kok Sam <https://github.com/sammkj>, Yui T. <https://github.com/yuit>
// Definitions by: Evan Bremer <https://github.com/evanbb>
// Isman Usoh <https://github.com/isman-usoh>
// François Nguyen <https://github.com/lith-light-g>
// Kok Sam <https://github.com/sammkj>
// Yui T. <https://github.com/yuit>
// Yamagishi Kazutoshi <https://github.com/ykzts>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from "react";
type HtmlProps = JSX.IntrinsicElements['html'];
type BodyProps = JSX.IntrinsicElements['body']
type LinkProps = JSX.IntrinsicElements['link'];
type MetaProps = JSX.IntrinsicElements['meta'];
@ -22,11 +31,11 @@ export interface HelmetTags {
export interface HelmetProps {
async?: boolean;
base?: any;
bodyAttributes?: Object;
bodyAttributes?: BodyProps;
defaultTitle?: string;
defer?: boolean;
encodeSpecialCharacters?: boolean;
htmlAttributes?: any;
htmlAttributes?: HtmlProps;
onChangeClientState?: (
newState: any,
addedTags: HelmetTags,
@ -74,7 +83,7 @@ export interface HelmetHTMLBodyDatum {
export interface HelmetHTMLElementDatum {
toString(): string;
toComponent(): React.HTMLAttributes<HTMLElement>;
toComponent(): React.HTMLAttributes<HTMLHtmlElement>;
}
export const peek: () => HelmetData;

View File

@ -108,6 +108,10 @@ function HTML() {
<html lang="en" />
</HelmetDefaultExport>;
// $ExpectError
<Helmet htmlAttributes={{ invalidProp: 'foo' }} />;
// $ExpectError
<Helmet bodyAttributes={{ invalidProp: 'foo' }} />;
// $ExpectError
<Helmet link={[ invalidProp: 'foo' ]} />;
// $ExpectError