question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

typescript support

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
sapegincommented, Apr 16, 2017

react-docgen-typescript may be useful for some use cases.

2reactions
Guriacommented, Mar 31, 2016

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found