Skip to content

Commit

Permalink
Remember that components can have more than one prop 🤦
Browse files Browse the repository at this point in the history
  • Loading branch information
hasparus committed Nov 27, 2020
1 parent 8d44d47 commit a9f2994
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/react/types/jsx-namespace.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ import 'react'
import { Interpolation } from '@emotion/serialize'
import { Theme } from './index'

type WithConditionalCSSProp<P> = { className: string } extends P
? P & { css?: Interpolation<Theme> }
// prettier-ignore
type WithConditionalCSSProp<P> =
'className' extends keyof P
? string extends P['className']
? P & { css?: Interpolation<Theme> }
: P
: P

// unpack all here to avoid infinite self-referencing when defining our own JSX namespace
Expand Down

0 comments on commit a9f2994

Please sign in to comment.