Skip to content

Commit

Permalink
Merge remote-tracking branch 'srmagura/styled-prop-string' into let-s…
Browse files Browse the repository at this point in the history
…tyledopts-arg-be-optional

# Conflicts:
#	packages/native/types/base.d.ts
#	packages/styled/types/base.d.ts
  • Loading branch information
Andarist committed Jun 5, 2022
2 parents 59e8aec + 09df01d commit 65f4444
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 10 deletions.
10 changes: 10 additions & 0 deletions .changeset/good-cars-roll.md
@@ -0,0 +1,10 @@
---
'@emotion/native': patch
'@emotion/styled': patch
---

pr: #2759
author: @srmagura
author: @Andarist

Change the argument of the `shouldForwardProp` option of `styled` from `PropertyKey` to `string` in the TypeScript definitions.
8 changes: 8 additions & 0 deletions .changeset/purple-ladybugs-think.md
@@ -0,0 +1,8 @@
---
'@emotion/is-prop-valid': patch
---

pr: #2759
author: @srmagura

Change the type of the argument to `isPropValid` from `PropertyKey` to `string` in the TypeScript definitions.
2 changes: 1 addition & 1 deletion packages/is-prop-valid/types/index.d.ts
@@ -1,5 +1,5 @@
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
// TypeScript Version: 2.1

declare function isPropValid(string: PropertyKey): boolean
declare function isPropValid(prop: string): boolean
export default isPropValid
10 changes: 6 additions & 4 deletions packages/native/types/base.d.ts
Expand Up @@ -64,9 +64,9 @@ export type Interpolation<
*/
export interface FilteringStyledOptions<
Props = Record<string, any>,
ForwardedProps extends keyof Props = keyof Props
ForwardedProps extends keyof Props & string = keyof Props & string
> {
shouldForwardProp?: (propName: string) => propName is ForwardedProps & string
shouldForwardProp?: (propName: string) => propName is ForwardedProps
}

export interface StyledOptions<Props = Record<string, any>> {
Expand Down Expand Up @@ -149,7 +149,8 @@ export interface CreateStyledComponent<
export interface CreateStyled {
<
C extends React.ComponentClass<React.ComponentProps<C>>,
ForwardedProps extends keyof React.ComponentProps<C> = keyof React.ComponentProps<C>
ForwardedProps extends keyof React.ComponentProps<C> &
string = keyof React.ComponentProps<C> & string
>(
component: C,
options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps>
Expand Down Expand Up @@ -178,7 +179,8 @@ export interface CreateStyled {

<
C extends React.ComponentType<React.ComponentProps<C>>,
ForwardedProps extends keyof React.ComponentProps<C> = keyof React.ComponentProps<C>
ForwardedProps extends keyof React.ComponentProps<C> &
string = keyof React.ComponentProps<C> & string
>(
component: C,
options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps>
Expand Down
13 changes: 8 additions & 5 deletions packages/styled/types/base.d.ts
Expand Up @@ -19,10 +19,10 @@ export { ComponentSelector, Interpolation }
*/
export interface FilteringStyledOptions<
Props = Record<string, any>,
ForwardedProps extends keyof Props = keyof Props
ForwardedProps extends keyof Props & string = keyof Props & string
> {
label?: string
shouldForwardProp?: (propName: string) => propName is ForwardedProps & string
shouldForwardProp?: (propName: string) => propName is ForwardedProps
target?: string
}

Expand Down Expand Up @@ -121,7 +121,8 @@ export interface CreateStyledComponent<
export interface CreateStyled {
<
C extends React.ComponentClass<React.ComponentProps<C>>,
ForwardedProps extends keyof React.ComponentProps<C> = keyof React.ComponentProps<C>
ForwardedProps extends keyof React.ComponentProps<C> &
string = keyof React.ComponentProps<C> & string
>(
component: C,
options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps>
Expand Down Expand Up @@ -150,7 +151,8 @@ export interface CreateStyled {

<
C extends React.ComponentType<React.ComponentProps<C>>,
ForwardedProps extends keyof React.ComponentProps<C> = keyof React.ComponentProps<C>
ForwardedProps extends keyof React.ComponentProps<C> &
string = keyof React.ComponentProps<C> & string
>(
component: C,
options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps>
Expand All @@ -171,7 +173,8 @@ export interface CreateStyled {

<
Tag extends keyof JSX.IntrinsicElements,
ForwardedProps extends keyof JSX.IntrinsicElements[Tag] = keyof JSX.IntrinsicElements[Tag]
ForwardedProps extends keyof JSX.IntrinsicElements[Tag] &
string = keyof JSX.IntrinsicElements[Tag] & string
>(
tag: Tag,
options: FilteringStyledOptions<JSX.IntrinsicElements[Tag], ForwardedProps>
Expand Down

0 comments on commit 65f4444

Please sign in to comment.