Typescript 3.2 bug: FormControl component="fieldset" not valid
See original GitHub issueTypescript 3.2.1:
<FormControl component="fieldset" className={classes.formControl}>
[ts] Type '"fieldset"' is not assignable to type '"object" | "ruby" | "table" | "small" | "sub" | "embed" | "caption" | "menu" | "menuitem" | "meter" | "abbr" | "address" | "article" | "aside" | "b" | "bdi" | "bdo" | "big" | "blockquote" | ... 62 more ... | undefined'. [2322]
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Typescript 3.2 bug: FormControl component="fieldset" not valid
Perfectly safe at runtime since every attribute for div is a valid attribute for fieldset . This is currently a limitation of our...
Read more >'component' does not exist in type 'FormControlProps' - Stack ...
It gives me following error: Object literal may only specify known properties, and 'component' does not exist in type ...
Read more >formcontrol object object | The AI Search Engine You Control
It based on Cristian Deschamps answer. I update validity only on blur, so if value was invalid before focus it will be invalid...
Read more >Selectors Level 4 - W3C
Note: Some pseudo-classes are mutually exclusive (such that a compound selector containing them, while valid, will never match anything), while ...
Read more >How to Change MUI TextField's Border Color (Hover, Focus ...
Like the Input component, the color prop only changes focus color, not hover color. The key to styling the TextField component is understanding ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
DefinitelyTyped/DefinitelyTyped#30764 improved typechecking for
React.ReactType
which bites us here since our typings only support additional props that are assignable to thediv
element (which is the default forFormControl
). Howeverfieldset
has some additional attributes and that’s why the compiler is (rightfully) complaining.Defeat device:
Perfectly safe at runtime since every attribute for
div
is a valid attribute forfieldset
.This is currently a limitation of our typings. With v4 we definitely plan to make our props are generic which should resolve those issues at the cost of an additional requirement in the form of explicitly typed callbacks.
I’m going to add a test case where we expect an error so that we’re reminded once this get’s fixed.
I’m currently in the process of simultaneously learning React, MUI and TS, and I just ran today into the exact issue discussed in this thread. As I can’t really (yet) understand both the problem and its (temporary?) solution, I begin to wonder if tackling TS and MUI at the same time makes sense for a beginner, and maybe also, if now is a good time to do it. I’d appreciate any comments, thanks!