question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

xxxProps type error with data-* attribute

See original GitHub issue
  • 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 😯

When specifying PaperProps there’s a type error.

Expected Behavior 🤔

There should be no type error.

Steps to Reproduce 🕹

https://codesandbox.io/s/material-demo-h11wl demo.tsx, row 55:

PaperProps={{ 'data-testid': '123' }}

Steps:

  1. Add the following the a Popover:
PaperProps={{ 'data-testid': '123' }}

image

Error:

Object literal may only specify known properties, and ‘‘data-testid’’ does not exist in type ‘Partial<PaperProps>’.ts(2769)

Context 🔦

Cypress needs selectors for targeting elements, and using a data-id or data-testid attribute is the preferred solution that doesn’t rely on styling selectors which might change over time.

Your Environment 🌎

Tech Version
Material-UI v4.8.0
React v16.12.0
Browser
TypeScript v3.7.3
etc.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
eps1loncommented, Dec 27, 2019

Closing this in favor of https://github.com/microsoft/TypeScript/issues/28960. Please upvote and subscribe to that issue instead if you’d like to see this fixed.

0reactions
oscar-bcommented, Dec 16, 2019

@oscar-b Oh great, so it’s somewhat a limitation of TypeScript?

That’s the way I interpret it, at least 😕

Read more comments on GitHub >

github_iconTop Results From Across the Web

xxxProps type error with data-* attribute · Issue #18874 - GitHub
The issue is present in the latest release. I have searched the issues of this repository and believe that this is not a...
Read more >
property 'children' does not exist on type 'intrinsicattributes'.ts ...
I had the following error when I use JSX sample code in TSX. (property) use:sortable: true Type '{ children: any; "use:sortable": true; class:...
Read more >
New Validation Attributes in ASP.NET MVC 3 Future
Introduction: Validating user inputs is an very important step in collecting information from users because it helps you to prevent errors ...
Read more >
Solved: Re: React Website + Marketo - Marketing Nation
When I try to render the component below, I get the error message "ReferenceError: MktoForms2 is not defined".
Read more >
Setting up Play Framework 2.5.x with Hibernate OGM Neo4j
<persistence-unit name="defaultPersistenceUnit" transaction-type="RESOURCE_LOCAL"> ... <non-jta-data-source>DefaultDS</non-jta-data-source> ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found