-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Type: tree-select package #36493
Type: tree-select package #36493
Conversation
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
41c8a25
to
b8b29ca
Compare
013eb10
to
0cb0e15
Compare
Putting this on hold. The TS translation here is handy, but I'd like to apply my learnings when I get WordPress/gutenberg#18942 sorted. |
0cb0e15
to
82b0b7d
Compare
@@ -76,7 +110,8 @@ const NULLISH_KEY = {}; | |||
* Note: Inserts WeakMaps except for the last map which will be a regular Map. | |||
* The last map is a regular one because the the key for the last map is the string results of args.join(). | |||
*/ | |||
function insertDependentKey( map, key, currentIndex, arr ) { | |||
function insertDependentKey( map: any, key: unknown, currentIndex: number, arr: unknown[] ) { |
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.
This is an unusual reducer function, it consumes an array of keys to walk a tree data structure (WeakMaps
of WeakMaps
) until it reaches a leaf which is a Map< string, CachedSelectorResultValue >
.
I've typed map
as any
because usage suggests this internal function is working well enough and it was difficult to type it as Map<…> | WeakMap<…>
here.
I've redone this according to latest best practices in Calypso and it should be ready to move forward. |
d7c09c3
to
7230688
Compare
7230688
to
b7d80ab
Compare
Thanks for the changes and review @sarayourfriend! Since I'm a bit distanced from this work right now, I'd be most comfortable if you handle landing this at your leisure. |
tree-select
to TypeScript.props to @beaucollins who was the original author of most of the typings.
Testing instructions
Confirm that clean produces a clean directory (nothing in
packages/tree-select/{dist,types}
).Confirm that build produces expected output (CommonJS in
packages/tree-select/dist/cjs
and ECMAScript Module in corresponding…/esm
directory.}Compare with most recent published builds:
esm
: https://unpkg.com/browse/@automattic/[email protected]/dist/esm/index.jscjs
: https://unpkg.com/browse/@automattic/[email protected]/dist/cjs/index.jsThe results should be similar but not identical.