-
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
Polish ResizableBox and convert it to TypeScript. #35062
Conversation
Size Change: +558 B (0%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
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.
Thanks for this contribution! It's great to see more people contribution to the TypeScript types in the components package. There are a few things that need to change before this is mergable though. Otherwise, great work!
packages/components/src/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js
Outdated
Show resolved
Hide resolved
c929e00
to
c07f615
Compare
c07f615
to
8d9bac7
Compare
import { Resizable } from 're-resizable'; | ||
import type { ResizableProps } from 're-resizable'; |
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.
These can be combined into a single import I think?
import { Resizable } from 're-resizable'; | |
import type { ResizableProps } from 're-resizable'; | |
import { Resizable, ResizableProps } from 're-resizable'; |
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.
That's what I did at first, but ESLint complained:
I don't really understand what the issue was, or if there even is an actual issue and not just an ESLint issue, but using import type
worked. It looks like eslint-plugin-import
is out-of-date (the version in Gutenberg's main package.json
is 2.23.4
, but the latest release is 2.24.2
, so maybe that's the issue?
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.
Huh... that's weird. It seems like it's probably an eslint configuration issue with TypeScript 🤔 import/named
is likely looking at the real JavaScript exports and ignoring the TS type exports (which would be in a separate .d.ts
file for a compiled package).
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 figure it's not a blocker for merge, though, right?
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.
Nope, not at all!
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.
LGTM! Thanks again for this.
import { Resizable } from 're-resizable'; | ||
import type { ResizableProps } from 're-resizable'; |
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.
Nope, not at all!
Summary
This PR converts the
ResizableBox
component to TypeScript and cleans some stuff up along the way.Part of #18838.
List of changes
ResizableBox
and its sub-components to TypeScript.ResizableBox
component function so they aren't duplicated for every instance.null
properties were included inReact.CSSProperties
objects, which expectundefined
for empty values.resize-tooltip/styles/resize-tooltip.styles.js
.strictNullChecks
for@wordpress/components
. (Helped a lot in finding some of the above issues.)How has this been tested?
I inserted a Spacer block and used checked to make sure the drag handles work and display tooltips as before.
Checklist:
*.native.js
files for terms that need renaming or removal).