-
Notifications
You must be signed in to change notification settings - Fork 834
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] Update demos to TypeScript #1990
Comments
@OnkelTem Thanks for the feedback. We do no longer support v3, we would encourage you to have a look at https://next.material-ui-pickers.dev/. Also, I think that we can use this as an opportunity to update all the demos to TypeScript (once we move the source into the main repo, we will get the JavaScript version automatically generated. |
I think here is a conflict between date-fns and moment adapter. It is actually the same problem as described here https://next.material-ui-pickers.dev/guides/typescript#important-note-on-type-inference Actually we need not to only update demos, but also autogenerate demos for different adapters |
Linking #1650 as related. |
Good, I'm gonna try the next version then. |
Switched to the version 4.x (4.0.0-alpha.9) and right away I get an error: import { LocalizationProvider } from '@material-ui/pickers';
// pick an adapter for your date library
import MomentUtils from '@material-ui/pickers/adapter/moment';
// ...
<LocalizationProvider dateAdapter={ MomentUtils }>
^^^^^^^^^^^
Ideas? |
Omg, folks, that was not reliable: I couldn't reproduce the previous problem in a new clean project. Ignore everything from below (I forgot to type useState())
<DatePicker
value={selectedDate}
onChange={handleDateChange}
^^^^^^^^
renderInput={props => <TextField {...props} />}
/>
|
@OnkelTem Well, this confusion is IMHO a good argument as to why we need to bring TypeScript demos (#1990) and isolated demos (#1650) that can open in CodeSandbox. This alone, I think will be a significant differentiator with the alternative React date pickers. As a developer, when you are evaluating different options, you have limited time to experiment with each of them. |
There's also one problem with the pickers in WebStorm. The Usually one can Ctrl-click on any property of a component and get into its definition. With Any ideas? |
Which version are you using? Do you have a reproduction with codesandbox 4.0.0-alpha.9? |
@oliviertassinari No, I cannot reproduce the problem with properties not being resolved in CodeSandbox. I can create a ticket however in the WebStorm issue queue about this problem. Also, I think it's worth trying the same in VS Code. |
@OnkelTem Cool, in this case, we can ignore it. Let's focus on updating all the demos to TypeScript, this increases the TypeScript test coverage at the same time than helping new users. |
It was fixed in https://next.material-ui.com/components/pickers/. |
Current Behavior 馃槸
Project cannot be compiled due to a TS error.
Expected Behavior 馃
No error.
Steps to Reproduce 馃暪
https://codesandbox.io/s/autumn-pond-6n2p7?file=/src/App.tsx
As you may see, there are errors in the 14, 22 and 29 lines.
They don't prevent project from running on that sandbox, but locally it fails to build.
I followed the installation guide and opted to moment.js as the utils lib:
Context 馃敠
I try to get the first example from the docs working, to understand how it's assumed to be used at all.
Your Environment 馃寧
The text was updated successfully, but these errors were encountered: