fix: add instanceof fallback for cases of duplicated module resolution #982
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.
We've recently had reports of
not an Address
error from people building on Algorand: algorandfoundation/algokit-utils-ts#399The cause seems to be two different
Address
classes being imported from the SDK. From the user's perspective, they are using the rightalgosdk.Address
class, but depending on how dependencies import this class it might not properly evaluate ininstanceof
checks.I've personally encountered this when using the tinyman sdk. The fix would seemingly be to have every library that uses algosdk to list it as a
peerDependency
but even with this change the same error was still happening. This is despitenpm ls algosdk
showing every module being dedpued. Perhaps it has to do with how it's imported.Keeping this PR as draft while we discuss the best way to properly fix this.
To reproduce, clone this repo: https://github.com/joe-p/arc84_poc and run the following commands (
main
has the fix, which is an override using this PR)git checkout 53d63e9c0a62b16abfc3f3803649894502ea7ec5 rm -rf node_modules && npm i bun scripts/headless_demo.ts
Error:
npm ls output: