-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Add downlevel dts master #9847
Add downlevel dts master #9847
Conversation
00bb321
to
038b7f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have updated package.json
of all libs
and addons
, I think we need to do the same for all /apps
packages that are written in TS.
@lychyi Thanks for this PR 😍 great work! 👍 |
Y'all are so on top of this stuff. Great work!!! 🙇🙇🙇 |
@gaetanmaisse Good points, I just followed the example on downlevel-dts so I had to think about it for a sec. This was the most compelling reason I could think of:
And yes, good call on the It probably is worth it to say though, I'll defer to the maintainers because that's the biggest impact as a result of this question. I don't have a strong preference. |
038b7f9
to
22c067e
Compare
@ndelangen @kroeder what do you think about downlevel-dts' output folder ⬆️ #9847 (comment) and #9847 (comment)? |
✏️ Just writing down a mental note here ✏️ This PR still may need the |
22c067e
to
f0edad2
Compare
@gaetanmaisse Note: I added this to every For example, if someone wants to create a new package, do they copy and paste from an existing Maintainers: feel free to modify the PR if that wasn't the right call or I can do it as soon as you let me know. |
@lychyi LGTM! I just added a commit with some Tested locally:
@shilman @ndelangen don't know if someone else wants to take a look 👨🏻💻 If not, I think it can be merged, what's the process, merge on |
@gaetanmaisse This PR targets master, so let's merge this to master first I'm unsure if cherry-picking this is easier then creating an additional PR against next? |
@gaetanmaisse Ah, I think I wrongly assumed that only packages with the |
@lychyi I think it was a valid assumption but there are suspicious things with these packages I will take a look at them 🔍🕵 |
@lychyi Thanks for your work 🎉 🎉 🙇 I will cherry-pick and create the PR for |
🎉Thanks for the assist! ❤️ Lovin' the project and are more than happy to help. @gaetanmaisse @ndelangen @shilman |
@lychyi @gaetanmaisse @ndelangen I just realized that this was merged into I just released the second PR as part of https://github.com/storybookjs/storybook/releases/tag/v6.0.0-alpha.14 Since this feels like a biggish change, can you please QA that release a bit and let me know if it looks good? Once I get your go-ahead, I'll release this change on 5.3.x. Thanks!! 🙏🙏🙏 |
🛑 It looks like there is a bug with Addon Centered because it's the only package that export types from "root" dir. Here is the fix: #9907 Everything else looks good. |
Issue: Fixes #9463, an alternative to #9826
While there are incompatible declaration outputs between TypeScript 3.7+ and TS3.5, there is a workaround to use the latest TypeScript version while still maintaining compatible
d.ts
files. This is accomplished by using downlevel-dts to generate alternative typings for users on a certain version of TypeScript.In this PR, any users who are on TS3.5 and below, TypeScript will automatically look at the
package.json
for a field calledtypesVersions
and utilize the typings in that folder via a mapping.What I did
I modified the
compile-tsc.js
script to usedownlevel-dts
and generate typings from thedist
folder to ats3.5/dist
folder. Then I added the above snippet to eachpackage.json
with a correspondingtypes
field. I'm assuming otherpackage.json
s withouttypes
are not actually exporting any TypeScript files.Refer to the comments in #9463 for more detail.
How to test
I tested it by manually altering
node_modules
with this output in@storybook/channels
inside my own project that suffers from #9463. The project indeeds builds correctly now with TypeScript 3.5.3 and Storybook 5.3.12.I also verified that the folder
lib/channels/ts3.5/dist/index.d.ts
has this line:instead of
I'd probably like a second set of eyes on it to make sure it works and also help out on any automated tests(if we think it's worth the effort).