Skip to content
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

bug: dumi-afx-deps解析问题 #1957

Open
jeffwcx opened this issue Oct 31, 2023 · 0 comments
Open

bug: dumi-afx-deps解析问题 #1957

jeffwcx opened this issue Oct 31, 2023 · 0 comments

Comments

@jeffwcx
Copy link
Collaborator

jeffwcx commented Oct 31, 2023

Version

2.2.14

OS Version

macOS13.5

Node.js Version

18.0.0

Browser Version

Chrome/118.0.0.0

Link to minimal reproduction

https://github.com/jeffwcx/dumi

Steps to reproduce

dumi-afx-deps解析问题
编写类型

(e?: MouseEvent) => void

会被解析为

{
  "type": "function",
  "signature": {
    "isAsync": false,
    "returnType": {
      "type": "void"
    },
    "arguments": [
      {
        "key": "e",
        "type": "MouseEvent | undefined",
        "hasQuestionToken": true
      }
    ]
  },
  "className": "__type"
},

What is expected?

应该解析为

{
  "type": "function",
  "signature": {
    "isAsync": false,
    "returnType": {
      "type": "void"
    },
    "arguments": [
      {
        "key": "e",
        "type": "MouseEvent",
        "hasQuestionToken": true
      }
    ]
  },
  "className": "__type"
},

What is actually happening?

(e: MouseEvent | undefined) => void

应该被解析为

"arguments": [
  {
    "key": "e",
    "type": "MouseEvent | undefined",
    "hasQuestionToken": false
  }
]

(e?: MouseEvent) => void

则应该被解析为

"arguments": [
  {
    "key": "e",
    "type": "MouseEvent",
    "hasQuestionToken": true
  }
]

两者在类型上还是由区别的,不应该混淆

Any additional comments? (optional)

None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant