I would like to use a SignalStore
whose state type uses union or recursive types but as ngrx withComputed
destructures the state type into multiple signals, that does not work.
type Entries = Array<{ fileName: string } | { folderName: string; entries?: Entries }>;
const initialState: Entries = [
{ fileName: 'autoexec.bat' },
{ fileName: 'config.sys' },
{
folderName: 'DOS',
entries: [
{ fileName: 'himem.sys' }
]
}
];
const EntryStore = signalStore(
withState<Entries>(initialState),
withComputed(state => ({
maxLevel: computed(() => state.<NOTHING!!!>)
}))
);
Is it possible for withComputed
to receive the whole state (as a Signal<Entries>
) instead of a destructured one (which yields nothing in my case).