Skip to content

Commit

Permalink
fix: change the order of function overloading(createTheme) (#1410)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Skoufis <askoufis@users.noreply.github.com>
  • Loading branch information
pengooseDev and askoufis authored Jun 14, 2024
1 parent b86f3f5 commit 99e974b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/shiny-fans-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@vanilla-extract/css": patch
---

Fixes a bug causing incorrect type inference when calling `createTheme` with a theme contract
8 changes: 4 additions & 4 deletions packages/css/src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ export function createGlobalTheme(
}
}

export function createTheme<ThemeTokens extends Tokens>(
tokens: ThemeTokens,
debugId?: string,
): [className: string, vars: ThemeVars<ThemeTokens>];
export function createTheme<ThemeContract extends Contract>(
themeContract: ThemeContract,
tokens: MapLeafNodes<ThemeContract, string>,
debugId?: string,
): string;
export function createTheme<ThemeTokens extends Tokens>(
tokens: ThemeTokens,
debugId?: string,
): [className: string, vars: ThemeVars<ThemeTokens>];
export function createTheme(arg1: any, arg2?: any, arg3?: string): any {
const themeClassName = generateIdentifier(
typeof arg2 === 'object' ? arg3 : arg2,
Expand Down

0 comments on commit 99e974b

Please sign in to comment.