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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/components/input/src/input.ts
Expand Up @@ -58,6 +58,13 @@ export const inputProps = buildProps({
type: String,
default: 'text',
},
/**
* @description rows of input
*/
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

/**
* @description control the resizability
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/arrays.ts
Expand Up @@ -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

}

// TODO: remove import alias
Expand Down