Skip to content

Conversation

@sai6855
Copy link
Contributor

@sai6855 sai6855 commented Apr 12, 2023

@mui-bot
Copy link

mui-bot commented Apr 12, 2023

Netlify deploy preview

https://deploy-preview-36863--material-ui.netlify.app/

Bundle size report

No bundle size changes

Generated by 🚫 dangerJS against ad107fa


// baseline behavior
<TextField variant="filled" {...filledProps} />;
// @ts-expect-error
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed this because didn't understand the reasoning behind expecting typescript error when classes are getting applied.

@zannager zannager requested a review from michaldudak April 12, 2023 14:25
@zannager zannager added the scope: text field Changes related to the text field. label Apr 12, 2023
Comment on lines +33 to +35
inputAdornedStart: string;
/** Styles applied to the input element if `endAdornment` is provided. */
inputAdornedEnd: string;
Copy link
Member

Choose a reason for hiding this comment

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

If I remove both of these classes, it throws an error in outlined variant textfield, when the variant="outlined" is not explicitly provided to the Text Field component.

Also, these classes are for the standard text field. Not sure why it throws type error for an implicit outlined text field if I remove them. If you can find out the reason it would be great.

Copy link
Contributor Author

@sai6855 sai6855 Apr 17, 2023

Choose a reason for hiding this comment

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

@ZeeshanTamboli when variant="outlined" is not applied, in component implementaion code, default component is set to OutlinedInput here. but types in d.ts file doesn't know that if variant is not provided it should apply OutlinedTextFieldProps to TextFieldProps.

but types in d.ts file doesn't know that if variant is not provided it should apply OutlinedTextFieldProps to TextFieldProps.

code reference: https://github.com/mui/material-ui/blob/master/packages/mui-material/src/TextField/TextField.d.ts#L229

but types d.ts file doesn't know that if variant is not provided it should apply OutlinedTextFieldProps to TextFieldProps.

Although this will be fixed in this PR #36737

Copy link
Member

Choose a reason for hiding this comment

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

If the type is going to be fixed in #36737 where TypeScript will be able to pick OutlinedTextFieldProps for implicit outlined variant, then I think you can include these classes in that PR. There isn't a need to create a separate PR because it is related to the bug you are trying to solve. Here in this PR, in my opinion, it is confusing for implicit outlined text field (i.e variant is not applied). The classes being added here is only for the standard variant, not for outlined text fields.

This would help in future if somebody wants to check the related PR. Basically, it should not confuse a future reader. We also don't know when that PR will be merged and released after this.

Copy link
Contributor Author

@sai6855 sai6855 Apr 17, 2023

Choose a reason for hiding this comment

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

@ZeeshanTamboli okay, i've moved changes to #36737 , can you review that PR. I will close this PR, once #36737 is merged

@sai6855
Copy link
Contributor Author

sai6855 commented May 2, 2023

Closing this PR as fixes are done in #36737

@sai6855 sai6855 closed this May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: text field Changes related to the text field.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TextField] typescript error when using inputAdornedStart, inputAdornedEnd classes with standard variant

4 participants