Skip to content

Typescript typings breaking when omitting props for TextField #19579

Closed
@JamieS1211

Description

@JamieS1211

I am making a component that forwards prop types to material UI components. When doing this with TextField I get complaints about "variant" type being incompatable.

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

Error is given in typescript

Expected Behavior 🤔

Would expect no error and it to function in the same way as with other components such as Typography

Steps to Reproduce 🕹

https://codesandbox.io/s/material-ui-typescript-wierdness-yk119

Context 🔦

I have made custom formik inputs. In these instances props such as error, helperText etc. are set by formik hence I want to omit them to prevent intelisense suggesting them as valid props on my fields.

image

Your Environment 🌎

See codesandbox for more details

Tech Version
Material-UI v4.9.1
React 16.12.0
Browser
TypeScript 3.7.4
etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: text fieldThis is the name of the generic UI component, not the React module!duplicateThis issue or pull request already existstypescript

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions