Skip to content

Commit

Permalink
This might be blocked on accessor decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Oct 11, 2024
1 parent 25656df commit 9f61694
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ember-resources/src/type-tests/use.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { expectTypeOf } from 'expect-type';

import { cell, type Reactive, resource, resourceFactory, use } from '../index.ts';
import { cell, resource, resourceFactory, use } from '../index.ts';

import type { Reactive } from '../index.ts';

const StuckClock = resource(() => 2);

Expand Down Expand Up @@ -36,6 +38,7 @@ class DemoA {
let demoA = new DemoA();

expectTypeOf<typeof demoA.stuck>().toMatchTypeOf<number>();
expectTypeOf(demoA.clock).toMatchTypeOf<Reactive<number>>();
expectTypeOf<typeof demoA.clock>().toMatchTypeOf<Reactive<number>>();
expectTypeOf<typeof demoA.paramClock>().toMatchTypeOf<string>();
expectTypeOf<typeof demoA.paramClock2>().toMatchTypeOf<string>();
Expand Down
2 changes: 1 addition & 1 deletion ember-resources/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export type ResourceFunction<Value = unknown> = (hooks: ResourceAPI) => Value |
*/
export type ResourceFn<Value = unknown> = (hooks: ResourceAPI) => Value;

export type Resource<Value = unknown> = Value & Reactive<Value>;
export type Resource<Value = unknown> = Value | Reactive<Value>;

export type Destructor = () => void;
export type Cache = object;

0 comments on commit 9f61694

Please sign in to comment.