diff --git a/typings/__tests__/__snapshots__/index.tests.js.snap b/typings/__tests__/__snapshots__/index.tests.js.snap index 08a9a0d..84b20d3 100644 --- a/typings/__tests__/__snapshots__/index.tests.js.snap +++ b/typings/__tests__/__snapshots__/index.tests.js.snap @@ -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'; @@ -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 */; @@ -112,7 +112,7 @@ export type APropTypes = Record>; * Component description. */ -export default class A extends Component { +export default class A extends React.Component { static propTypes: APropTypes; /** diff --git a/typings/stringify-component-definition.js b/typings/stringify-component-definition.js index 63b1560..7fe1ffd 100644 --- a/typings/stringify-component-definition.js +++ b/typings/stringify-component-definition.js @@ -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': @@ -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} @@ -196,7 +196,7 @@ function stringifyComponentDefinition(info) { export type ${propTypesTypeName} = Record>; ${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')} }