-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Data: Bundle TypeScript types with the data package #43315
Conversation
… in the package.json)
Size Change: +610 B (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
I'm not the best person to review this PR, but everything looks good at first glance. We could clean up the gutenberg/packages/data/tsconfig.json Lines 17 to 23 in 30e9392
In other packages that have gutenberg/packages/element/tsconfig.json Line 11 in 30e9392
I tested it locally and types build and validate correctly. |
@gziolo done! Let's see how the checks turn out 🤞 |
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.
I would appreciate some sanity check from a TypeScript expert 😄
One thing we could do is to land this PR and publish WordPress packages to npm from |
Let's give it a try so we can test on npm and revert if necessary before the planned bi-weekly publishing happening tomorrow. |
It seems to be working well, good idea with the |
What?
This PR exposes TypeScript types with the
@wordpress/data
package by adding"types": "build-types"
to package.json.This would provide autocompletion support to the consumer of this package:
CleanShot.2022-06-09.at.16.36.16.mp4
While the types are not 100% complete, they have been iterated on and already provide value. Exposing them creates an incentive to improve them further as every contribution would immediately benefit
@wordpress/data
consumers.Why is it a breaking change?
Currently, TypeScript uses the DefinitelyTyped types for the
@wordpress/data
package. With this PR, it will use the types shipped with the@wordpress/data
itself and ignore the types from DefinitelyTyped. The two are not compatible, hence this PR lists a breaking change in the changelog.Test plan
Confirm the checks are all green
cc @gziolo @dmsnell