typescript support
See original GitHub issueI wonder if typescript
support is in the scope of this package.
It works well for transpiled stateless components, but can’t recognize component transpiled from export class SomeStatefulComponent extends React.Component
variant:
var SomeStatefulComponent = (function (_super) {
__extends(SomeStatefulComponent, _super);
function SomeStatefulComponent(props) {
_super.call(this, props);
this.state = {
foo: 'bar',
};
}
SomeStatefulComponent.prototype.render = function () {
return react_1.createElement('div', {});
};
SomeStatefulComponent.defaultProps = {
bar: 'baz'
};
return SomeStatefulComponent;
}(react_1.Component));
exports.SomeStatefulComponent = SomeStatefulComponent;
But it seems that generated d.ts
files is much more great source to parse:
import { Component } from 'react';
export interface SomeStatefulComponentProps {
/**
* jsdoc
*/
bar: string;
}
/**
* jsdoc
*/
export declare class SomeStatefulComponent extends Component<SomeStatefulComponentProps, {
foo: string;
}> {
static defaultProps: {
foo: string;
};
constructor(props: SomeStatefulComponentProps);
render(): __React.ReactElement<{}>;
}
export default SomeStatefulComponent;
Issue Analytics
- State:
- Created 7 years ago
- Reactions:6
- Comments:7 (2 by maintainers)
Top Results From Across the Web
TypeScript: JavaScript With Syntax For Types.
TypeScript extends JavaScript by adding types to the language. TypeScript speeds up your development experience by catching errors and providing fixes ...
Read more >TypeScript - Wikipedia
TypeScript supports definition files that can contain type information of existing JavaScript libraries, much like C++ header files can describe the ...
Read more >TypeScript Programming with Visual Studio Code
Visual Studio Code includes TypeScript language support but does not include the TypeScript compiler, tsc . You will need to install the TypeScript...
Read more >TypeScript | IntelliJ IDEA Documentation - JetBrains
IntelliJ IDEA supports developing, running, and debugging TypeScript source code. IntelliJ IDEA recognizes .ts and .tsx files and provides ...
Read more >TypeScript Introduction - W3Schools
TypeScript is JavaScript with added syntax for types. ... as Visual Studio Code, have built-in TypeScript support and can show errors as you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
react-docgen-typescript may be useful for some use cases.
Not sure if Typescript AST can be easy converted to Babylon one. Here is an example of parsing Typescript one: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter