Skip to content

[4.0.0] Extending React.Component without @extends tag #458

@Huulivoide

Description

@Huulivoide

Trying to produce documentation for class that extends React.Component fill fail. (Stack trace at the end)
I have not been able to trace the origin of the bug, so far I know that in default-theme/section._
section.augments contains an item { title: 'augments', name: undefined }. That undefined name will eventually fail in globals-doc/index.js getDoc funktion.

The bug will only happen, if the jsdoc block doesn't explicitly mark the class as one extending React.Component.

import React from 'react';
// Using require() will also lead to the same problem.

/**
 * This will fail.
 */
class Foo extends React.Component {}
import React from 'react';

/**
 * This will work.
 *
 * @extends React.Component
 */
class Bar extends React.Component {}

And the stack trace in case it will help somehow.

TypeError: Cannot read property 'toLowerCase' of undefined
at Object.module.exports.getDoc (/foo/bar/node_modules/globals-docs/index.js:48:40)
at Object.link (/foo/bar/node_modules/documentation-theme-utils/index.js:19:56)
at Function.module.exports.link (/foo/bar/node_modules/documentation/default-theme/lib/format_markdown.js:61:22)
at imports.autolink (/foo/bar/node_modules/documentation/default-theme/index.js:69:29)
at eval (lodash.templateSources[0]:35:20)
at Array.map (native)
at eval (lodash.templateSources[0]:34:28)
at eval (lodash.templateSources[3]:84:11)
at Array.forEach (native)
at eval (lodash.templateSources[3]:80:7)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions