Skip to content

Commit 9ee4e87

Browse files
client: fix new tsx behavior which overwrites (?) fields of subclasses (#3945)
* client: fix new tsx behavior which overwrites (?) fields of subclasses * client: make tsc happy * make any erasable
1 parent ebea878 commit 9ee4e87

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

packages/client/src/sync/fetcher/fetcher.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ export abstract class Fetcher<JobTask, JobResult, StorageItem> extends Readable
6565
protected destroyWhenDone: boolean // Destroy the fetcher once we are finished processing each task.
6666
syncErrored?: Error
6767

68-
private _readableState?: {
69-
// This property is inherited from Readable. We only need `length`.
70-
length: number
71-
}
72-
7368
private writer: Writable | null = null
7469

7570
/**
@@ -352,10 +347,13 @@ export abstract class Fetcher<JobTask, JobResult, StorageItem> extends Readable
352347
return false
353348
}
354349
const jobStr = this.jobStr(job)
355-
if (this._readableState === undefined || this._readableState!.length > this.maxQueue) {
350+
if (
351+
(this as any)._readableState === undefined ||
352+
(this as any)._readableState!.length > this.maxQueue
353+
) {
356354
this.DEBUG &&
357355
this.debug(
358-
`Readable state length=${this._readableState!.length} exceeds max queue size=${
356+
`Readable state length=${(this as any)._readableState!.length} exceeds max queue size=${
359357
this.maxQueue
360358
}, skip job ${jobStr} execution.`,
361359
)

packages/client/test/sync/fetcher/fetcher.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe('should handle expiration', async () => {
7676
})
7777

7878
fetcher['in'].insert(job as any)
79-
fetcher['_readableState'] = []
79+
;(<any>fetcher)['_readableState'] = []
8080
fetcher['running'] = true
8181
fetcher['total'] = 10
8282
fetcher.next()

0 commit comments

Comments
 (0)