Skip to content

Functions showing as "unknown" when encased in parentheses #994

@kyletsang

Description

@kyletsang

I have a prop that is defined as propName: (() => string) | undefined and the function portion of it is showing as "unknown" for the tsType

Minimal input

interface Props {
  name: (() => string) | undefined
}

const MyComponent = ({name}: Props) => {
  return <div />;
}

Output:

[
  {
    "description": "",
    "displayName": "MyComponent",
    "methods": [],
    "props": {
      "name": {
        "required": true,
        "tsType": {
          "name": "union",
          "raw": "(() => string) | undefined",
          "elements": [
            {
              "name": "unknown"
            },
            {
              "name": "undefined"
            }
          ]
        },
        "description": ""
      }
    }
  }
]

Tested on v8.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions