Skip to content

Commit

Permalink
Allow null in rainbow sprinkle values (#91)
Browse files Browse the repository at this point in the history
Co-authored-by: Rogin Farrer <rfarrer@wayfair.com>
  • Loading branch information
roginfarrer and Rogin Farrer committed Dec 6, 2022
1 parent 19bd82c commit 0af248c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/clever-kids-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'rainbow-sprinkles': patch
---

Update types to allow `null` in sprinkle values
6 changes: 4 additions & 2 deletions packages/rainbow-sprinkles/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,17 @@ export type DefinePropertiesReturn = {

type ValueOrConditionObject<T, Conditions extends ConditionalPropertyValue> =
| T
| Partial<Record<keyof Conditions['conditions'], T>>;
| null
| Partial<Record<keyof Conditions['conditions'], T | null>>;

type ValueOrConditionObjectStatic<
T,
Values extends { [k: string]: ConditionalPropertyValue },
> =
| T
| null
| {
[Condition in keyof Values[keyof Values]['conditions']]?: T;
[Condition in keyof Values[keyof Values]['conditions']]?: T | null;
};

export type PrefixValue<T> = T extends `-${infer Root}`
Expand Down

0 comments on commit 0af248c

Please sign in to comment.