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
Conversation
👋 @Henrycheheng, seems like this is your first time contribution to element-plus.
|
Hello @Henrycheheng, thank you for contributing to element-plus, please see our guideline to see how to make contribution |
🧪 Playground Preview: https://element-plus.run/?pr=16390 |
rows: { | ||
type: Number, | ||
default: 1, | ||
}, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i learn from it
quewtions no1:
question no2:
Explain problem: 不能将类型“(T & any[]) | Many[]”分配给类型“T[]”。 不能将类型“Many[]”分配给类型“T[]”。 不能将类型“Many”分配给类型“T”。 “T”可以使用与“Many”无关的任意类型进行实例化。