Add example : how to extract Props / State interface from react component using compiler API
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- react, typescript
- Domain
- documentation
Research direction
Start with the linked TypeScript Compiler API wiki example and the shown React.Component generic usage. Add a wiki example demonstrating extraction of the first generic type and showing the expected output for MyComponent; done means the example clearly answers the requested Props/State extraction.
Written by the indexing model from the issue text.
Description
Hello.
I have this sources
import * as React from 'react';
export interface MyComponentProps{
prop1: number;
prop2: string;
}
/**
* descriptions for component
*/
export class MyComponent extends React.Component<MyComponentProps,{}>{
render(){
return(
<div>
</div>
);
}
}
I use docgen from this wiki example
this is output
[
{
"name": "MyComponent",
"documentation": "descriptions for component",
"type": "typeof MyComponent",
"constructors": [
{
"paramters": [],
"returnType": "MyComponent",
"documentation": ""
}
]
}
]
I want to extend this output by type of first generic passed to react.component.
How to extract generic type passed to parent class?
Thank you!
- Dominant language
- JavaScript
- Stars
- 759
- Forks
- 315
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/TypeScript-wiki
-
Difficulty 1/5 Under an hour Newbie friendliness 50/100
microsoft/TypeScript-wiki#327 ·
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
microsoft/TypeScript-wiki#323 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
microsoft/TypeScript-wiki#307 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
microsoft/TypeScript-wiki#293 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
microsoft/TypeScript-wiki#266 ·
All issues in microsoft/TypeScript-wiki
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
palladius/rails8-app-on-gcp#145 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
dotenvx/dotenv-vscode#139 ·
-
test-change-proposal
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
web-platform-tests/interop#1455 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
corsairdev/corsair#1764 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100