chore(packages): remove isolatedDeclarations for store type inference support (#295)

This commit is contained in:
rahim
2026-01-06 14:09:36 +11:00
committed by GitHub
parent 47659f5352
commit 0354e3ef9c
32 changed files with 137 additions and 512 deletions
+2 -10
View File
@@ -6,18 +6,10 @@ import { isObject } from '../predicate/predicate';
export type Selector<State, Selected> = (state: State) => Selected;
/**
* Extracts the state keys a selector depends on by running it once
* and inspecting the result object's keys.
*
* Returns `null` if the selector returns a primitive or array
* (keys cannot be determined).
* Extract state keys a selector depends on. Returns null for primitives/arrays.
*
* @example
* const selector = (s: State) => ({ volume: s.volume, muted: s.muted });
* getSelectorKeys(selector, state); // ['volume', 'muted']
*
* const primitiveSelector = (s: State) => s.volume;
* getSelectorKeys(primitiveSelector, state); // null
* getSelectorKeys((s) => ({ volume: s.volume }), state); // ['volume']
*/
export function getSelectorKeys<State, Selected>(
selector: Selector<State, Selected>,
+2 -2
View File
@@ -19,8 +19,8 @@ describe('pick', () => {
});
it('ignores non-existent keys', () => {
const obj = { a: 1, b: 2 } as Record<string, number>;
expect(pick(obj, ['a', 'nonexistent'] as (keyof typeof obj)[])).toEqual({ a: 1 });
const obj = { a: 1, b: 2 };
expect(pick(obj, ['a', 'nonexistent' as keyof typeof obj])).toEqual({ a: 1 });
});
it('handles nested objects (shallow copy)', () => {