You might be wondering why this is not a TypeScript enum or const enum.
One of the goals of this library is to enable people to use some or none of it without having to
bundle all of it.
If we made the set of error codes an enum then anyone who imported it (even if to only use a
single error code) would be forced to bundle every code and its label.
Const enums appear to solve this problem by letting the compiler inline only the codes that are
actually used. Unfortunately exporting ambient (const) enums from a library like
@wallet-standard/errors is not safe, for a variety of reasons covered here:
https://stackoverflow.com/a/28818850
A union of every Wallet Standard error code
You might be wondering why this is not a TypeScript enum or const enum.
One of the goals of this library is to enable people to use some or none of it without having to bundle all of it.
If we made the set of error codes an enum then anyone who imported it (even if to only use a single error code) would be forced to bundle every code and its label.
Const enums appear to solve this problem by letting the compiler inline only the codes that are actually used. Unfortunately exporting ambient (const) enums from a library like
@wallet-standard/errors
is not safe, for a variety of reasons covered here: https://stackoverflow.com/a/28818850