diff --git a/src/observable.ts b/src/observable.ts index fc1861bc5..9272a3e22 100644 --- a/src/observable.ts +++ b/src/observable.ts @@ -35,16 +35,12 @@ function createObservable(value: T, makePrimitive: boolean): Observable | export type MaybePromiseObservable = Observable>; export function observable(): MaybePromiseObservable; -export function observable(value: Promise): MaybePromiseObservable>; -export function observable(value?: Promise): MaybePromiseObservable | undefined>; export function observable(value: T): MaybePromiseObservable; export function observable(value?: T): MaybePromiseObservable { return createObservable(value, /*makePrimitive*/ false); } export function observablePrimitive(): ObservablePrimitive>; -export function observablePrimitive(value: Promise): ObservablePrimitive>>; -export function observablePrimitive(value?: Promise): ObservablePrimitive> | undefined>; export function observablePrimitive(value: T): ObservablePrimitive>; export function observablePrimitive(value?: T): ObservablePrimitive> { return createObservable(value, /*makePrimitive*/ true); diff --git a/tests/tests.test.ts b/tests/tests.test.ts index a3634a970..3d9822d8b 100644 --- a/tests/tests.test.ts +++ b/tests/tests.test.ts @@ -2195,7 +2195,7 @@ describe('Promise values', () => { test('when callback works with promises', async () => { let resolver: (value: number) => void; const promise = new Promise((resolve) => (resolver = resolve)); - const obs = observable(promise); + const obs = observable(promise); let didWhen = false; when(obs, () => { didWhen = true; @@ -2208,7 +2208,7 @@ describe('Promise values', () => { test('when works with promises', async () => { let resolver: (value: number) => void; const promise = new Promise((resolve) => (resolver = resolve)); - const obs = observable(promise); + const obs = observable(promise); let didWhen = false; when(obs).then(() => { didWhen = true; @@ -2564,7 +2564,7 @@ describe('Locking', () => { }); describe('Primitive <-> Object', () => { test('Starting as undefined', () => { - const obs = observable<{ test: string }>(undefined); + const obs = observable<{ test: string } | undefined>(undefined); expect(obs.get()).toEqual(undefined); obs.set({ test: 'hi' }); expect(obs.get()).toEqual({ test: 'hi' });