client: fix new tsx behavior which overwrites (?) fields of subclasses #3945
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At the RC releases PR #3886 which only updated package.jsons, changelogs, readmes and package-lock, for some reason when running client in
tsxmode (sonpm run client:start:ts) the Fetcherclient/src/sync/fetcher/fetcher.tswould throw:This does NOT happen when running in
npm run client:start:js. It also does not happen if you attach a debugger,tsx --inspect-brk bin/cli.tsFor some reason the RC releases have changed something in the specific tsx run. I think it would take the field
_readableStatewhich is marked asprivateon theFetcherand somehow overwrite this value in the constructor of the Fetcher. This breaks the entire Readable object. The workaround (for now) is to castthisasanyand query the fields which we need (should likely find a way to get the same result but not reading private properties of Readable).This fix allows the client to start syncing!
I still do not know what the
npm run client:start:ts(this runstsx bin/cli.ts) does different than if I attach a debugger. How come the end result is different? Without this change, in the constructor of Fetcher, logconsole.log(this)aftersuper(and one will see that almost the entire object is empty instead of having an initialized Readable 🤔