Skip to content

Commit

Permalink
better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Huliiiiii committed Oct 1, 2024
1 parent ea9f57a commit ab424d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/solid/src/reactive/signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -884,8 +884,8 @@ export function untrack<T>(fn: Accessor<T>): T {
export type ReturnTypes<T> = T extends readonly Accessor<unknown>[]
? { [K in keyof T]: T[K] extends Accessor<infer I> ? I : never }
: T extends Accessor<infer I>
? I
: never;
? I
: never;

// transforms a tuple to a tuple of accessors in a way that allows generics to be inferred
export type AccessorArray<T> = [...Extract<{ [K in keyof T]: Accessor<T[K]> }, readonly unknown[]>];
Expand Down
6 changes: 4 additions & 2 deletions packages/solid/test/signals.type-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -888,10 +888,12 @@ interface KobaltSingleSelectProps<T> {
value?: T | null;
onChange?: (value: T) => void;
}

interface KobaltMultiSelectProps<T> {
value?: T[];
onChange?: (value: T[]) => void;
}

type KobaltSelectProps<Option, OptGroup = never> = (
| KobaltSingleSelectProps<Option>
| KobaltMultiSelectProps<Option>
Expand All @@ -900,9 +902,9 @@ type KobaltSelectProps<Option, OptGroup = never> = (

type fruits = "apple" | "banana" | "orange";
const fruits: fruits[] = ["apple", "banana", "orange"];
const [tks, setTks] = createSignal<fruits>("apple");
const [fruit, setFruit] = createSignal<fruits>("apple");
function kobalteSelect<T>(props: KobaltSelectProps<T>) {}
kobalteSelect({ value: tks(), onChange: setTks, options: fruits });
kobalteSelect({ value: fruit(), onChange: setFruit, options: fruits });

//////////////////////////////////////////////////////////////////////////
// test explicit generic args ////////////////////////////////////////////
Expand Down

0 comments on commit ab424d5

Please sign in to comment.