-
Notifications
You must be signed in to change notification settings - Fork 509
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
Update React template with ESM and type #152
Conversation
|
Hm, interesting to hear this, what's your source? Haven't seen anything pointing to that in the ecosystem... But that notwithstanding, the idiomatic way to import React currently in the official documentation and any non-TypeScript tutorial is currently |
🤷 not something i care too much about, anyone using tsdx will well be able to tweak that file on their own. |
Gonna close as this is a project-by-project decision. |
Also, IIRC from Formik if you do this in your lib, you force ppl consuming it to do it as well |
Both true. However I would argue that since you are making a zero-config scaffolder for new projects, you are in the unique position of teaching people that are new to a language or framework what the common defaults are in the ecosystem with your choices of default templates. Some users (both beginners and not) will want and place weight in the suggestion from you, and starting with a suggestion that doesn't match the majority of React teaching materials is confusing. As a further reference, scaffolding out a TS app with
This would potentially be an issue, do you have a reference for this? |
Here's my source facebook/react#11503 |
Hm, this is all news to me, so thanks for the link. However, I think your interpretation of the sentiment is different than mine - the discussion in that thread isn't exactly ringing praise for this syntax:
And from your facebook/react#13080 PR:
The last part is what I'm focusing on. It may be better in the future to change this syntax in tutorials, examples and tooling like scaffolders, but that change should probably be done then, when (and if) it ever becomes standard/idiomatic. |
tsdx shouldn’t make this decision tho. Your app should. If you use this, AFAIK, then you force this decision onto all users of your library. This happened once in Formik and people got pissed off because it broke their stuff. |
Either way it is a decision made by
I agree this is an unacceptable problem, and would like to know more about it. Maybe there's a way around it. And if not, maybe it should be reported as a bug. |
Was jaredpalmer/formik#625 the issue in Formik? I tried searching for |
Re: @TrySound's comment, looks like there's been some more movement in this direction from Facebook (PR Sebastian Markbåge): Maybe |
Hey, thanks for this project, really great work!
Because we have
compilerOptions.esModuleInterop
set to true intsconfig.json
, we can add the normal ES Modules syntax for importing React, or am I missing something?And we can use the
React.FC
type for the dummy component.