mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
[react-helmet] relax htmlAttributes and bodyAttributes types (#39983)
* style(react-helmet): format with prettier * fix(react-helmet): relax htmlAttributes and bodyAttributes types This preserves type-checking of known attributes but also allows for arbitrary attributes like `data-*`.
This commit is contained in:
committed by
Jesse Trinity
parent
a04f0db950
commit
4b67565486
Vendored
+9
-8
@@ -6,14 +6,19 @@
|
||||
// Kok Sam <https://github.com/sammkj>
|
||||
// Yui T. <https://github.com/yuit>
|
||||
// Yamagishi Kazutoshi <https://github.com/ykzts>
|
||||
// Justin Hall <https://github.com/wKovacs64>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as React from "react";
|
||||
import * as React from 'react';
|
||||
|
||||
type HtmlProps = JSX.IntrinsicElements['html'];
|
||||
type HtmlProps = JSX.IntrinsicElements['html'] & {
|
||||
[key: string]: string;
|
||||
};
|
||||
|
||||
type BodyProps = JSX.IntrinsicElements['body']
|
||||
type BodyProps = JSX.IntrinsicElements['body'] & {
|
||||
[key: string]: string;
|
||||
};
|
||||
|
||||
type LinkProps = JSX.IntrinsicElements['link'];
|
||||
|
||||
@@ -36,11 +41,7 @@ export interface HelmetProps {
|
||||
defer?: boolean;
|
||||
encodeSpecialCharacters?: boolean;
|
||||
htmlAttributes?: HtmlProps;
|
||||
onChangeClientState?: (
|
||||
newState: any,
|
||||
addedTags: HelmetTags,
|
||||
removedTags: HelmetTags,
|
||||
) => void;
|
||||
onChangeClientState?: (newState: any, addedTags: HelmetTags, removedTags: HelmetTags) => void;
|
||||
link?: LinkProps[];
|
||||
meta?: MetaProps[];
|
||||
noscript?: Array<any>;
|
||||
|
||||
@@ -108,10 +108,6 @@ function HTML() {
|
||||
<html lang="en" />
|
||||
</HelmetDefaultExport>;
|
||||
|
||||
// $ExpectError
|
||||
<Helmet htmlAttributes={{ invalidProp: 'foo' }} />;
|
||||
// $ExpectError
|
||||
<Helmet bodyAttributes={{ invalidProp: 'foo' }} />;
|
||||
// $ExpectError
|
||||
<Helmet link={[ invalidProp: 'foo' ]} />;
|
||||
// $ExpectError
|
||||
|
||||
Reference in New Issue
Block a user