Skip to content

0.19.0 broke support for typescript 3.9.7 #1362

@Dergash

Description

@Dergash

Recent upgrade to typescript 4.*.* in 0.19.0 broke backward-compatibility for typescript 3.9.7 due to the unchecked usage of ts.isNamedTupleMember call: e136469#diff-b580b34740b3647ff5b29f4cb299a61aR77
which results in the following output when trying to generate documentation with TS 3.9.7:

C:\projects\tesler-ui\node_modules\typedoc\dist\lib\converter\types\tuple.js:44
        return ts.isNamedTupleMember(node);
                  ^

TypeError: ts.isNamedTupleMember is not a function

I believe the change was introduced due to #1357.

Investigating further I've also found that the 0.17.0 also broke support for typescript 3.7.3 (which is version used in create-react-app
typescript template) due to the unchecked usage of ts.isIdentifierOrPrivateIdentifier: 5d41a2e#diff-560fefcd039cbf06578d6f95c3e57753R413

I've prepared a PR to restore backward compatibility.

I've also found following issues warning about not following declared peer dependency: #1240, #1257, #979

Although I'll agree that backward compatibility might be not a requirement for 0.*.* library and peer dependency are indeed warn you, broken typescript versions are pretty recent and the fix is pretty simple and non-invasive so it'll be nice to support those versions until typescript 4 stabilizes a bit so majority typedoc users may migrate to 4.*.*

Search terms

isNamedTupleMember, isIdentifierOrPrivateIdentifier, typescript 3

Expected Behavior

typedoc is backward compatible for typescript versions 3.7.3 and 3.9.7

Actual Behavior

yarn typedoc command results in the following output on the project with typescript 3.9.7:

Using TypeScript 3.9.7 from C:\projects\tesler-ui\node_modules\typescript\lib
C:\projects\tesler-ui\node_modules\typedoc\dist\lib\converter\types\tuple.js:44
        return ts.isNamedTupleMember(node);
                  ^

TypeError: ts.isNamedTupleMember is not a function

Steps to reproduce the bug

I've prepared an example project to reproduce the bug:
https://github.com/Dergash/typedoc-tamed-tuples (master branch for 3.7.3 example, 3.9.7 branch for 3.9.7)
Just clone it, yarn install, yarn typedoc and you'll receive the output

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions