Skip to content

Commit

Permalink
Fix typing errors for color-picker (#38430)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw authored Feb 3, 2022
1 parent 19ffdc4 commit a082a0b
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/components/src/circular-option-picker/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
/**
* External dependencies
*/
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/color-palette/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
/**
* External dependencies
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/color-picker/color-display.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { colord, extend, Colord } from 'colord';
import type { Colord } from 'colord';

/**
* WordPress dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/color-picker/color-input.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { colord, extend, Colord } from 'colord';
import type { Colord } from 'colord';

/**
* Internal dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/color-picker/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const ColorPicker = (
} );

const safeColordColor = useMemo( () => {
return colord( color );
return colord( color || '' );
}, [ color ] );

const debouncedSetColor = useDebounce( setColor );
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/color-picker/use-deprecated-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ function getColorFromLegacyProps( props: LegacyProps ): string | undefined {
if ( props.color.hex ) {
return props.color.hex;
}

return undefined;
}

const transformColorStringToLegacyColor = memoize(
Expand Down
3 changes: 3 additions & 0 deletions packages/components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"src/base-field/**/*",
"src/button/**/*",
"src/card/**/*",
"src/circular-option-picker/**/*",
"src/color-palette/**/*",
"src/color-picker/**/*",
"src/confirm-dialog/**/*",
"src/dashicon/**/*",
"src/disabled/**/*",
Expand Down

0 comments on commit a082a0b

Please sign in to comment.