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

fix(components): [Input] input's row props that are not declared in the typefile and fix return value Many<T>[] not matching the type of T[] #16390

Closed
wants to merge 4 commits into from

Conversation

Henrycheheng
Copy link

quewtions no1:
SF1H8_B{8SH9OCLV5I`U84Q
question no2:
Explain problem: 不能将类型“(T & any[]) | Many[]”分配给类型“T[]”。 不能将类型“Many[]”分配给类型“T[]”。 不能将类型“Many”分配给类型“T”。 “T”可以使用与“Many”无关的任意类型进行实例化。

Copy link

👋 @Henrycheheng, 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 Apr 3, 2024
Copy link

github-actions bot commented Apr 3, 2024

Copy link

github-actions bot commented Apr 3, 2024

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

@Henrycheheng Henrycheheng removed their assignment Apr 3, 2024
@Henrycheheng Henrycheheng changed the title fix(components): input's row props that are not declared in the typefile and fix return value Many<T>[] not matching the type of T[] fix(components): [Input] input's row props that are not declared in the typefile and fix return value Many<T>[] not matching the type of T[] Apr 4, 2024
@github-actions github-actions bot added the CommitMessage::Qualified Qualified commit message label May 3, 2024
Copy link

github-actions bot commented May 3, 2024

🧪 Playground Preview: https://element-plus.run/?pr=16390
Please comment the example via this playground if needed.

rows: {
type: Number,
default: 1,
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is no need to set the rows prop here. The native textarea supports setting rows directly, and attrs is also directly bound in the code.

Copy link
Author

Choose a reason for hiding this comment

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

tanks a lot. this problem may exist the ide and my version of ts

@@ -5,7 +5,7 @@ type Many<T> = T | ReadonlyArray<T>
/** like `_.castArray`, except falsy value returns empty array. */
export const castArray = <T>(arr: Many<T>): T[] => {
if (!arr && (arr as any) !== 0) return []
return Array.isArray(arr) ? arr : [arr]
return Array.isArray(arr) ? (arr as T[]) : [arr as T]
Copy link
Collaborator

Choose a reason for hiding this comment

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

There seems to be no problem under the ts version that the code currently depends on, and it may not need to be modified.

Copy link
Author

Choose a reason for hiding this comment

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

great

Copy link
Author

Choose a reason for hiding this comment

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

i learn from it

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.

None yet

2 participants