Skip to content

Commit 1a7c3a5

Browse files
committed
feat: widen withResource to Resource beyond ResourceRef
1 parent 6625d07 commit 1a7c3a5

6 files changed

Lines changed: 206 additions & 55 deletions

File tree

libs/ngrx-toolkit/src/lib/with-resource.spec.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,14 @@ describe('withResource', () => {
319319
{ providedIn: 'root', protectedState: false },
320320
withState({ id: undefined as number | undefined }),
321321
withResource(({ id }) => ({
322-
list: httpResource<{ id: number; name: string }[]>(
323-
() => '/address',
322+
list: httpResource<
324323
{
325-
defaultValue: [],
326-
},
327-
),
324+
id: number;
325+
name: string;
326+
}[]
327+
>(() => '/address', {
328+
defaultValue: [],
329+
}),
328330
detail: httpResource<Address>(() =>
329331
id() ? `/address/${id()}` : undefined,
330332
),
@@ -609,7 +611,9 @@ describe('withResource', () => {
609611
IsEqual<typeof _store.digitValue, Signal<number | undefined>>
610612
>;
611613
});
612-
614+
it('only exposes reload methods for reloadable resources', () => {
615+
// TODO - can type tests for _reload be done?
616+
});
613617
describe('mapToResource', () => {
614618
it('satisfies the Resource interface without default value', () => {
615619
const Store = signalStore(

0 commit comments

Comments
 (0)