diff --git a/.changeset/shy-islands-talk.md b/.changeset/shy-islands-talk.md new file mode 100644 index 000000000..48422affb --- /dev/null +++ b/.changeset/shy-islands-talk.md @@ -0,0 +1,5 @@ +--- +"solid-js": patch +--- + +Improve signal setter type for code completion of string literal unions. diff --git a/packages/solid/src/reactive/signal.ts b/packages/solid/src/reactive/signal.ts index 7811b1bd8..121c44ea0 100644 --- a/packages/solid/src/reactive/signal.ts +++ b/packages/solid/src/reactive/signal.ts @@ -179,12 +179,12 @@ export function createRoot(fn: RootFunction, detachedOwner?: typeof Owner) export type Accessor = () => T; export type Setter = { + (value: Exclude | ((prev: T) => U)): U; (...args: undefined extends T ? [] : [value: (prev: T) => U]): undefined extends T ? undefined : U; - (value: (prev: T) => U): U; (value: Exclude): U; - (value: Exclude | ((prev: T) => U)): U; + (value: (prev: T) => U): U; }; export type Signal = [get: Accessor, set: Setter];