mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
Add typing for children of react-document-title (#43022)
* Add typing for children of react-document-title react-document-title uses React.Children.only to get the only child, and raises an error if more than one child is passed. https://github.com/gaearon/react-document-title/blob/master/index.js#L31 * Add a test case with a child * Turns out it should be React.ReactChild Turns out it should be React.ReactChild * Fix typo
This commit is contained in:
parent
3ac9608f05
commit
31dadd46f9
1
types/react-document-title/index.d.ts
vendored
1
types/react-document-title/index.d.ts
vendored
@ -8,6 +8,7 @@ import * as React from 'react';
|
||||
|
||||
interface DocumentTitleProps {
|
||||
title: string;
|
||||
children?: React.ReactChild | null;
|
||||
}
|
||||
|
||||
declare class DocumentTitle extends React.Component<DocumentTitleProps, any> {
|
||||
|
||||
@ -6,3 +6,15 @@ class TitleTest extends React.Component<any, any> {
|
||||
return <DocumentTitle title="Test" />;
|
||||
}
|
||||
}
|
||||
|
||||
class TitleTestOneChild extends React.Component<any, any> {
|
||||
render() {
|
||||
return <DocumentTitle title="Test">A Child</DocumentTitle>;
|
||||
}
|
||||
}
|
||||
|
||||
class TitleTestOneReactChild extends React.Component<any, any> {
|
||||
render() {
|
||||
return <DocumentTitle title="Test"><div>A Child</div></DocumentTitle>;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user