Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Temzasse/stitches-native
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5fb9943f3644a3fc8aee12d55a914ea537a9081a
Choose a base ref
..
head repository: Temzasse/stitches-native
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7f5a39e52164e1416e9a6f565da2baf602f2217a
Choose a head ref
Showing with 12 additions and 5 deletions.
  1. +5 −5 src/types/stitches.d.ts
  2. +7 −0 src/types/util.d.ts
10 changes: 5 additions & 5 deletions src/types/stitches.d.ts
Original file line number Diff line number Diff line change
@@ -48,11 +48,11 @@ export default interface Stitches<
useTheme: () => string &
{
[Scale in keyof Theme]: {
[Token in keyof Theme[Scale]]: ThemeUtil.Token<
Extract<Token, string | number>,
string,
Extract<Scale, string | void>
>;
[Token in keyof Theme[Scale]]: Theme[Scale][Token] extends string
? Util.AliasedToken<Theme[Scale][Token]> extends never
? string
: Theme[Scale][Util.AliasedToken<Theme[Scale][Token]>]
: Theme[Scale][Token];
};
};
ThemeProvider: React.FunctionComponent<{ theme?: any }>; // TODO: fix `any`
7 changes: 7 additions & 0 deletions src/types/util.d.ts
Original file line number Diff line number Diff line change
@@ -36,3 +36,10 @@ export type Function = (...args: any[]) => unknown;
export type WideObject = {
[name in number | string]: boolean | number | string | undefined | WideObject;
};

/* Util for aliases tokens. Returns the aliased token if it's an alias, returns never if it's not. */
export type AliasedToken<V extends string> = V extends `${infer Head}${infer Tail}`
? Head extends "$"
? Tail
: never
: never;