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

DatePicker types does not include onClick #9734

Closed
1 task done
matsad111 opened this issue Jan 4, 2018 · 3 comments
Closed
1 task done

DatePicker types does not include onClick #9734

matsad111 opened this issue Jan 4, 2018 · 3 comments

Comments

@matsad111
Copy link

matsad111 commented Jan 4, 2018

I'm using the onClick property for the DatePicker component and it works fine, the only issue is that my VSC typescript linter is indicating that it is not a part of the type definition for this component.

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

No type errors would be fantastic - and this is the only one I've run into so far!

Current Behavior

This is the error I'm getting:
Property 'onClick' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<DatePicker> & Readonly<{ children?: ReactNode; }> ...'.

Steps to Reproduce (for bugs)

  1. Have typescript setup in a react environment
  2. Use import DatePicker from 'material-ui/DatePicker' to import the DatePicker. Right now, I'm getting around this error by using const DatePicker: any = require('material-ui/DatePicker'). Lame.
  3. Add an onClick property to your DatePicker. Eg:
    ... onClick={ () => console.log('opening the datepicker') } ...
  4. See annoying red stuff in your editor.

Context

Annoying typescript issue making me ask my boss annoying typescript questions. This is more an issue with typescript than you guys, but you've done a really awesome job so far, this is just a way to make it a little bit better.

Your Environment

We're running a react/redux/typescript app in Visual Studio Code. I installed the @types/material-ui file and it mostly works great, thanks for putting in all that work!

Tech Version
Material-UI 0.20.0
React 16.2.0
browser
Visual Studio Code 1.19.1
@types/material-ui 0.20.1
@oliviertassinari
Copy link
Member

We don't host the TypeScript definitions of v0.x. Please go to https://github.com/DefinitelyTyped/DefinitelyTyped.

@matsad111
Copy link
Author

Ok, thanks!

@matsad111
Copy link
Author

You are usingpropTypes, though, correct? I'm getting an another error that looks like one generated by that package and I wanted to make sure before I opened another issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants