reactjs / reactjs/react-docgen

export types or interfaces from another files

Open
#504 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.8k
Forks
316
Avg merge
5h 7m
Merged PRs (30d)
4

Description

file1

import * as React from 'react'
export interface interface1{
name: string
type?: string
}
export class Component1 extends React.Component<IconProps> {}

file2

import * as React from 'react'
import {interface1} from './file1'
export interface interface2{
value: string
type?: interface1
}

export class Component2 extends React.Component<IconProps> {}

the problem I have is that I have nested types and I can't get the types from the library only it give me the names of it .

is there any way to do this ?
I wonder also if I can export interfaces or types from the file not only the component if I can do this I can map unique name to its implementation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the file1 and file2 examples, then trace how react-docgen extracts component and type information from imported interfaces. Determine the expected representation for nested interfaces and their implementations; the work is done when the requested exported type information is available from the generated library output.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
documentation, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.