make @wordpress/block-editor types stricter (#42898)

Typescript@next is stricter about type parameters constrained to any;
they are default to unknown instead of any during inference for consistency with other
type parameters.

This means that the easiest workaround is to give a type parameter
constrained to `any` a default of `any` so that they once again
default to `any`.

That's what this PR does; it also has to give the subsequent type
parameter a default as well.
This commit is contained in:
Nathan Shively-Sanders 2020-03-06 09:21:10 -08:00 committed by GitHub
parent 958ad18f21
commit 0379f82590
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,8 +14,8 @@ declare namespace withColorContext {
// prettier-ignore
declare function withColorContext<
ProvidedProps extends Partial<withColorContext.Props>,
OwnProps extends any,
T extends ComponentType<ProvidedProps & OwnProps>
OwnProps extends any = any,
T extends ComponentType<ProvidedProps & OwnProps> = ComponentType<ProvidedProps & OwnProps>
>(component: T):
T extends ComponentType<infer U> ? ComponentType<
Omit<U, 'colors' | 'disableCustomColors' | 'hasColorsToChoose'> &