Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle a class and a function being exported from the same file #130

Open
gparlakov opened this issue Nov 5, 2021 · 0 comments
Open

Handle a class and a function being exported from the same file #130

gparlakov opened this issue Nov 5, 2021 · 0 comments

Comments

@gparlakov
Copy link
Owner

From the read.ts:

    if (isExportedClass(node)) {
        const classDeclaration = node as ts.ClassDeclaration;
        result = [
            {
                type: 'class',
                name: classDeclaration.name != null ? classDeclaration.name.getText() : 'default',
                constructorParams: readConstructorParams(node as ts.ClassDeclaration),
                publicMethods: readPublicMethods(node as ts.ClassDeclaration)
            }
        ];
    }

    if (isExportedFunction(node)) {
        const func = node as ts.FunctionDeclaration;
        result = [
            {
                type: 'function',
                name: func.name != null ? func.name.getText() : 'anonymousFunction'
            }
        ];
    }

If there are both a class and a function exported from a file the function will take precedence.

That's probably not what we want...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant