File tree Expand file tree Collapse file tree
packages/react-docgen/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import type Documentation from '../Documentation.js';
22import { getDocblock } from '../utils/docblock.js' ;
33import isReactForwardRefCall from '../utils/isReactForwardRefCall.js' ;
44import resolveToValue from '../utils/resolveToValue.js' ;
5- import type { NodePath , Node } from '@babel/traverse' ;
5+ import type { NodePath } from '@babel/traverse' ;
66import type { ComponentNode } from '../resolver/index.js' ;
77import type { Handler } from './index.js' ;
88
@@ -21,7 +21,7 @@ function getDocblockFromComponent(path: NodePath): string | null {
2121 }
2222 if ( description == null ) {
2323 // Find parent statement (e.g. var Component = React.createClass(<path>);)
24- let searchPath : NodePath < Node > | null = path ;
24+ let searchPath : NodePath | null = path ;
2525
2626 while ( searchPath && ! searchPath . isStatement ( ) ) {
2727 searchPath = searchPath . parentPath ;
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ import type Documentation from '../Documentation.js';
99import type { DefaultValueDescriptor } from '../Documentation.js' ;
1010import type { NodePath } from '@babel/traverse' ;
1111import type {
12- Node ,
1312 ObjectMethod ,
1413 ObjectProperty ,
1514 RestElement ,
@@ -70,7 +69,7 @@ function getStatelessPropsPath(
7069function getDefaultPropsPath (
7170 componentDefinition : NodePath < ComponentNode > ,
7271) : NodePath | null {
73- let defaultPropsPath : NodePath < Node > | null = getMemberValuePath (
72+ let defaultPropsPath : NodePath | null = getMemberValuePath (
7473 componentDefinition ,
7574 'defaultProps' ,
7675 ) ;
Original file line number Diff line number Diff line change 11import type { NodePath } from '@babel/traverse' ;
2- import type { Node } from '@babel/types' ;
32import getMemberValuePath from '../utils/getMemberValuePath.js' ;
43import resolveToValue from '../utils/resolveToValue.js' ;
54import setPropDescription from '../utils/setPropDescription.js' ;
@@ -33,7 +32,7 @@ const propDocblockHandler: Handler = function (
3332 documentation : Documentation ,
3433 componentDefinition : NodePath < ComponentNode > ,
3534) : void {
36- let propTypesPath : NodePath < Node > | null = getMemberValuePath (
35+ let propTypesPath : NodePath | null = getMemberValuePath (
3736 componentDefinition ,
3837 'propTypes' ,
3938 ) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import resolveToModule from '../utils/resolveToModule.js';
33import resolveToValue from '../utils/resolveToValue.js' ;
44import type Documentation from '../Documentation.js' ;
55import type { NodePath } from '@babel/traverse' ;
6- import type { ObjectExpression , Node } from '@babel/types' ;
6+ import type { ObjectExpression } from '@babel/types' ;
77import type { Handler } from './index.js' ;
88import type { ComponentNode } from '../resolver/index.js' ;
99
@@ -37,7 +37,7 @@ const propTypeCompositionHandler: Handler = function (
3737 documentation : Documentation ,
3838 componentDefinition : NodePath < ComponentNode > ,
3939) : void {
40- let propTypesPath : NodePath < Node > | null = getMemberValuePath (
40+ let propTypesPath : NodePath | null = getMemberValuePath (
4141 componentDefinition ,
4242 'propTypes' ,
4343 ) ;
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ import resolveToValue from '../utils/resolveToValue.js';
99import type Documentation from '../Documentation.js' ;
1010import type { PropDescriptor , PropTypeDescriptor } from '../Documentation.js' ;
1111import type { NodePath } from '@babel/traverse' ;
12- import type { Node } from '@babel/types' ;
1312import type { Handler } from './index.js' ;
1413import type { ComponentNode } from '../resolver/index.js' ;
1514
@@ -65,7 +64,7 @@ function getPropTypeHandler(propName: string): Handler {
6564 documentation : Documentation ,
6665 componentDefinition : NodePath < ComponentNode > ,
6766 ) : void {
68- let propTypesPath : NodePath < Node > | null = getMemberValuePath (
67+ let propTypesPath : NodePath | null = getMemberValuePath (
6968 componentDefinition ,
7069 propName ,
7170 ) ;
Original file line number Diff line number Diff line change 11/*eslint no-loop-func: 0, no-use-before-define: 0*/
22
33import resolveToValue from './resolveToValue.js' ;
4- import type { Node , NodePath } from '@babel/traverse' ;
4+ import type { NodePath } from '@babel/traverse' ;
5+ import type { Node } from '@babel/types' ;
56
67/**
78 * Splits a MemberExpression or CallExpression into parts.
Original file line number Diff line number Diff line change 1- import type { Node , NodePath } from '@babel/traverse' ;
1+ import type { NodePath } from '@babel/traverse' ;
22import getMembers from '../utils/getMembers.js' ;
33
44/**
55 * Returns true of the prop is required, according to its type definition
66 */
7- export default function isRequiredPropType ( path : NodePath < Node > ) : boolean {
7+ export default function isRequiredPropType ( path : NodePath ) : boolean {
88 return getMembers ( path ) . some (
99 ( { computed, path : memberPath } ) =>
1010 ( ! computed && memberPath . isIdentifier ( { name : 'isRequired' } ) ) ||
You can’t perform that action at this time.
0 commit comments