Skip to content

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

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

Open
kyletsang opened this issue May 1, 2025 · 1 comment
Open

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

kyletsang opened this issue May 1, 2025 · 1 comment

Comments

@kyletsang
Copy link

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

@kyletsang
Copy link
Author

Looks like it's due to the missing handling of TSParenthesizedType and might be solved in this PR: #915

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