Skip to content

fails on flow function type #671

@BurntSushi

Description

@BurntSushi

Given this code:

/**
 * Foo.
 */
function foo(): (any => Promise<string>) {
    throw new Error('unimplemented');
}

and running this command (from master):

$ documentation.js build --format html --output docs ./src/

I get:

TypeError: Cannot read property 'name' of null
    at params.type.params.map.param (/home/andrew/clones/documentation/lib/flow_doctrine.js:103:27)
    at Array.map (native)
    at flowDoctrine (/home/andrew/clones/documentation/lib/flow_doctrine.js:100:27)
    at Arguments.inferReturn (/home/andrew/clones/documentation/lib/infer/return.js:34:22)
    at comment (/home/andrew/clones/documentation/index.js:41:30)
    at Array.map (native)
    at /home/andrew/clones/documentation/index.js:115:40
    at arrayMap (/home/andrew/clones/documentation/node_modules/lodash/lodash.js:660:23)
    at map (/home/andrew/clones/documentation/node_modules/lodash/lodash.js:9571:14)
    at Function.flatMap (/home/andrew/clones/documentation/node_modules/lodash/lodash.js:9274:26)

It looks like your handling of FunctionTypeAnnotation assumes that a name for each formal parameter is provided, but in this case, the type (any => Promise<string>) has no names for its any parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy