From 2fe6903e071f7d1afba148ae5ba9b9d13d8445b8 Mon Sep 17 00:00:00 2001 From: Ryan Carniato Date: Wed, 13 Jan 2021 20:17:06 -0800 Subject: [PATCH] Fix #300, add state intersection --- packages/solid/src/reactive/state.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/solid/src/reactive/state.ts b/packages/solid/src/reactive/state.ts index 7fe68be25..36c0dfadf 100644 --- a/packages/solid/src/reactive/state.ts +++ b/packages/solid/src/reactive/state.ts @@ -25,8 +25,9 @@ type AddSymbolToStringTag = T extends { [Symbol.toStringTag]: infer V } type AddCallable = T extends { (...x: any[]): infer V } ? { (...x: Parameters): V } : {}; export type NotWrappable = string | number | boolean | Function | null; +// Intersection for missing fields https://github.com/microsoft/TypeScript/issues/13543 export type State = { - [P in keyof T]: T[P] extends object ? State : T[P]; + [P in keyof T]: T[P] extends object ? State & T[P] : T[P]; } & { [$RAW]?: T; } & AddSymbolToPrimitive &