Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change the order of function overloading(createTheme) #1410

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 .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