Skip to content

Commit

Permalink
fix(typings): import whole react in typings
Browse files Browse the repository at this point in the history
  • Loading branch information
Heymdall committed Jun 19, 2018
1 parent f1e2aae commit 703eaf8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions typings/__tests__/__snapshots__/index.tests.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`simple component with all prop types 1`] = `
"
import { Component, ReactNode } from 'react';
import * as React from 'react';
import * as Type from 'prop-types';
Expand Down Expand Up @@ -74,10 +74,10 @@ export type AProps = DeepReadonlyObject<{
requiredString: string;
optionalSymbol?: Symbol;
requiredSymbol: Symbol;
optionalNode?: ReactNode;
requiredNode: ReactNode;
optionalElement?: ReactNode;
requiredElement: ReactNode;
optionalNode?: React.ReactNode;
requiredNode: React.ReactNode;
optionalElement?: React.ReactNode;
requiredElement: React.ReactNode;
optionalMessage?: any/* Не нашёлся встроенный тип для типа {\\"name\\":\\"instanceOf\\",\\"value\\":\\"Message\\"}
* https://github.com/alfa-laboratory/library-utils/issues/new
*/;
Expand Down Expand Up @@ -112,7 +112,7 @@ export type APropTypes = Record<keyof AProps, Type.Validator<AProps>>;
* Component description.
*/
export default class A extends Component<AProps> {
export default class A extends React.Component<AProps> {
static propTypes: APropTypes;
/**
Expand Down
6 changes: 3 additions & 3 deletions typings/stringify-component-definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function stringifyType(type, componentName, propName, typeRefs) {
return 'Symbol';
case 'node':
case 'element':
return 'ReactNode';
return 'React.ReactNode';
case 'object':
return 'object';
case 'any':
Expand Down Expand Up @@ -184,7 +184,7 @@ function stringifyComponentDefinition(info) {

return (
`
import { Component, ReactNode } from 'react';
import * as React from 'react';
import * as Type from 'prop-types';
${DEPP_READONLY_TYPES}
Expand All @@ -196,7 +196,7 @@ function stringifyComponentDefinition(info) {
export type ${propTypesTypeName} = Record<keyof ${propsInterfaceName}, Type.Validator<${propsInterfaceName}>>;
${stringifyDescription(info.description, info.docblock)}
export default class ${info.displayName} extends Component<${propsInterfaceName}> {
export default class ${info.displayName} extends React.Component<${propsInterfaceName}> {
static propTypes: ${propTypesTypeName};
${methodsDefs.join('\n')}
}
Expand Down

0 comments on commit 703eaf8

Please sign in to comment.