Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changepacks/changepack_log_dRVzImm0AJhTH8RnWMkOY.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"changes": { "packages/react/package.json": "Patch" },
"note": "Fix globalCss typing",
"date": "2025-11-21T14:17:50.816538300Z"
}
15 changes: 15 additions & 0 deletions packages/react/src/utils/__tests__/global-css.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { AdditionalGlobalCssProps, GlobalCssProps } from '../global-css'

describe('globalCss', () => {
it('globalCss', () => {
assertType<GlobalCssProps | AdditionalGlobalCssProps>({
imports: ['https://example.com'],
a: {
color: 'blue',
},
_hover: {
bg: 'red',
},
})
})
})
8 changes: 4 additions & 4 deletions packages/react/src/utils/global-css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type GlobalCssKeys<T extends string> =
| `${keyof SVGElementTagNameMap}${T}`
| `_${CamelCase<ExtractSelector<T>>}`

type GlobalCssProps = {
export type GlobalCssProps = {
[K in GlobalCssKeys<AdvancedSelector>]?: DevupCommonProps &
DevupSelectorProps &
DevupThemeSelectorProps & {
Expand Down Expand Up @@ -56,13 +56,13 @@ interface FontFaceProps {
}

type Import = { url: string; query?: string } | string
interface AdditionalGlobalCssProps {
export interface AdditionalGlobalCssProps {
imports?: Import[]
fontFaces?: FontFaceProps[]
}

export function globalCss(
strings: AdditionalGlobalCssProps & GlobalCssProps,
strings: AdditionalGlobalCssProps | GlobalCssProps,
): void

export function globalCss(
Expand All @@ -80,7 +80,7 @@ export function globalCss(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
strings?:
| TemplateStringsArray
| (GlobalCssProps & AdditionalGlobalCssProps)
| (GlobalCssProps | AdditionalGlobalCssProps)
| Record<
string,
DevupCommonProps & DevupSelectorProps & DevupThemeSelectorProps
Expand Down