mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
[React] Add SFC displayName and fix onlyChild type
- `StatelessComponent` is missing an optional `displayName` property - `ReactChildren.only` always returns a `ReactElement` - add tests for the above and `ReactTestUtils.renderIntoDocument`
This commit is contained in:
Vendored
+2
-1
@@ -148,6 +148,7 @@ declare namespace __React {
|
||||
propTypes?: ValidationMap<P>;
|
||||
contextTypes?: ValidationMap<any>;
|
||||
defaultProps?: P;
|
||||
displayName?: string;
|
||||
}
|
||||
|
||||
interface ComponentClass<P> {
|
||||
@@ -2070,7 +2071,7 @@ declare namespace __React {
|
||||
map<T>(children: ReactNode, fn: (child: ReactChild, index: number) => T): T[];
|
||||
forEach(children: ReactNode, fn: (child: ReactChild, index: number) => any): void;
|
||||
count(children: ReactNode): number;
|
||||
only(children: ReactNode): ReactChild;
|
||||
only(children: ReactNode): ReactElement<any>;
|
||||
toArray(children: ReactNode): ReactChild[];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user