-
-
Notifications
You must be signed in to change notification settings - Fork 261
Closed
Labels
bugSomething isn't workingSomething isn't workingtypingsTypescript public type definitions issuesTypescript public type definitions issues
Milestone
Description
Missing/Incorrect APIs
The example below fails with Type instantiation is excessively deep and possibly infinite.(2589).
It's obvious that this problem is related to Currency variations. It works with 14 elements, but not more. I also tried 4.5.0-beta with Tail-Recursion Elimination but the result is the same.
Also, it could be workarounded via multiple arguments, but it leads to more verbose code.
import { createStore, combine } from 'effector';
type Currency = 'usd' | 'eur' | 'cny' | 'uah' | 'byn' | 'thb' | 'rub' | 'azn' | 'kzt' | 'kgs' | 'uzs' | 'tzs' | 'kes' | 'zar' | 'ron' | 'mdl' | 'ils' | 'inr' | 'pln' | 'chf' | 'gbp';
const initialValue = 'usd' as Currency;
const $currency = createStore<Currency>(initialValue)
type AutosearchTrigger = {
currency: Currency;
};
// Will fail with «Type instantiation is excessively deep and possibly infinite.»
const $autosearchTrigger = combine<AutosearchTrigger>({
currency: $currency,
});
const $autosearchTriggerViaTuple = combine<Currency, AutosearchTrigger>($currency, (currency) => ({
currency
}));Playground Link: Provided
Relevant documentation
combine(...stores, fn) works
combine({ A, B, C }, fn?) doesn't work
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtypingsTypescript public type definitions issuesTypescript public type definitions issues