Skip to content

refactor: type narrowing#13013

Closed
836334258 wants to merge 2 commits intoelement-plus:devfrom
836334258:dev
Closed

refactor: type narrowing#13013
836334258 wants to merge 2 commits intoelement-plus:devfrom
836334258:dev

Conversation

@836334258
Copy link

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow contributing guide English | (中文 | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer to relative issues for your PR.

Description

type narrowing

Related Issue

Explanation of Changes

@pull-request-triage
Copy link

👋 @836334258, seems like this is your first time contribution to element-plus.

  • Please make sure that you have read our guidelines and code of conduct before making a contribution.
  • You can comment with /label Components:[component_name] to add a label for which component you are working on.
  • You may join our Discord for staying tuned.

@pull-request-triage pull-request-triage bot added 1st contribution Their very first contribution Needs Review labels May 30, 2023
@github-actions
Copy link

@github-actions
Copy link

Hello @836334258, thank you for contributing to element-plus, please see our guideline to see how to make contribution

@btea
Copy link
Member

btea commented Jun 3, 2023

@ryuhangyeong Do you think this is necessary?

Copy link
Member

@ryuhangyeong ryuhangyeong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@btea

It looks like your existing code has type errors and needs to be changed.

But when I change the code like PR, typecheck throws an error.

What do you think?

image image

@836334258
Copy link
Author

The reason for my modification is that the editor has a line prompt, so I view it to modify it

@btea
Copy link
Member

btea commented Jun 3, 2023

@ryuhangyeong The error reported in the first screenshot may be due to the ts version problem. vscode now defaults to version 5, and the project uses 4.7.4. Switching ts to the workspace version should not report an error.

@btea
Copy link
Member

btea commented Jun 3, 2023

@836334258 Can you give a more specific description of the prompt?

@836334258
Copy link
Author

image
There is this prompt on my computer

@836334258
Copy link
Author

image
When I write like this, running pnpm typecheck will not report an error

@btea
Copy link
Member

btea commented Jun 3, 2023

It seems to be the same problem as I said above, the ts version should be switched.

The error disappears after the ts version is switched to the workspace version

image

@836334258
Copy link
Author

I tried it, and there will be no error when switching the typescript version to the project version, thank you!

@836334258 836334258 closed this Jun 4, 2023
@btea btea mentioned this pull request Jun 7, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants