Skip to content

Commit 00a7291

Browse files
fix(types): update type casting for watch functions to use WatchSource<T> (#4966)
1 parent ae45294 commit 00a7291

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

packages/rxjs/useExtractedObservable/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export function useExtractedObservable<T = any, E = unknown, Immediate extends R
9595
// Construct it first so that the `watch` can override the value if the observable emits immediately
9696
const obsRef = shallowRef<E | undefined>(options?.initialValue)
9797

98-
watch(source as any, (value, oldValue, onCleanup) => {
98+
watch(source as WatchSource<T>, (value, oldValue, onCleanup) => {
9999
subscription?.unsubscribe()
100100

101101
if (typeof value !== 'undefined' && value !== null) {

packages/rxjs/watchExtractedObservable/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export function watchExtractedObservable<T = any, E = unknown, Immediate extends
9999
subscription = undefined
100100
})
101101

102-
return watch(source as any, (value, oldValue, onCleanup) => {
102+
return watch(source as WatchSource<T>, (value, oldValue, onCleanup) => {
103103
subscription?.unsubscribe()
104104

105105
if (typeof value !== 'undefined' && value !== null) {

packages/shared/watchDeep/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function watchDeep<
3535
*/
3636
export function watchDeep<T = any, Immediate extends Readonly<boolean> = false>(source: T | WatchSource<T>, cb: any, options?: Omit<WatchOptions<Immediate>, 'deep'>) {
3737
return watch(
38-
source as any,
38+
source as WatchSource<T>,
3939
cb,
4040
{
4141
...options,

packages/shared/watchImmediate/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function watchImmediate<T extends object>(
2929
*/
3030
export function watchImmediate<T = any>(source: T, cb: any, options?: Omit<WatchOptions, 'immediate'>) {
3131
return watch(
32-
source as any,
32+
source as WatchSource<T>,
3333
cb,
3434
{
3535
...options,

packages/shared/watchOnce/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function watchOnce<T extends object>(
2828
*/
2929
export function watchOnce<T = any>(source: T, cb: any, options?: Omit<WatchOptions, 'once'>) {
3030
return watch(
31-
source as any,
31+
source as WatchSource<T>,
3232
cb,
3333
{
3434
...options,

0 commit comments

Comments
 (0)