From 682313b8151db4ab4517337a5a73556afa22ed55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Sun, 12 Jun 2022 10:16:57 +0200 Subject: [PATCH] add changesets --- .changeset/tall-flies-smoke.md | 8 ++++++++ .changeset/thirty-boats-hang.md | 6 ++++++ packages/native/types/base.d.ts | 5 +---- packages/styled/types/base.d.ts | 5 +---- 4 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 .changeset/tall-flies-smoke.md create mode 100644 .changeset/thirty-boats-hang.md diff --git a/.changeset/tall-flies-smoke.md b/.changeset/tall-flies-smoke.md new file mode 100644 index 000000000..cdb24cc23 --- /dev/null +++ b/.changeset/tall-flies-smoke.md @@ -0,0 +1,8 @@ +--- +'@emotion/native': patch +'@emotion/styled': patch +--- + +author: @Andarist + +`shouldForwardProp` has been changed from being a bivariant method to a contravariant function - it improves the type-safety for those that type this option. diff --git a/.changeset/thirty-boats-hang.md b/.changeset/thirty-boats-hang.md new file mode 100644 index 000000000..8b34829c5 --- /dev/null +++ b/.changeset/thirty-boats-hang.md @@ -0,0 +1,6 @@ +--- +'@emotion/native': patch +'@emotion/styled': patch +--- + +`FilteringStyledOptions` and `StyledOptions` types no longer require a type argument for the `Props` generic. diff --git a/packages/native/types/base.d.ts b/packages/native/types/base.d.ts index bd7d4d479..a14f22bad 100644 --- a/packages/native/types/base.d.ts +++ b/packages/native/types/base.d.ts @@ -58,10 +58,7 @@ export type Interpolation< | ArrayInterpolation | FunctionInterpolation -/** - * Same as StyledOptions but shouldForwardProp must be a type guard (https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates). - * Practical sense: you can define and reuse atomic `shouldForwardProp` filters that are strictly bound with some `ForwardedProps` type. - */ +/** Same as StyledOptions but shouldForwardProp must be a type guard */ export interface FilteringStyledOptions< Props = Record, ForwardedProps extends keyof Props & string = keyof Props & string diff --git a/packages/styled/types/base.d.ts b/packages/styled/types/base.d.ts index 59646dee8..05efbaea4 100644 --- a/packages/styled/types/base.d.ts +++ b/packages/styled/types/base.d.ts @@ -13,10 +13,7 @@ export { export { ComponentSelector, Interpolation } -/** - * Same as StyledOptions but shouldForwardProp must be a type guard (https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates). - * Practical sense: you can define and reuse atomic `shouldForwardProp` filters that are strictly bound with some `ForwardedProps` type. - */ +/** Same as StyledOptions but shouldForwardProp must be a type guard */ export interface FilteringStyledOptions< Props = Record, ForwardedProps extends keyof Props & string = keyof Props & string