Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ts2742 when resolving ts-common types
This error has been plaguing me for ages. It appears to be caused by the static inferred type of an io-ts codec depending on a type in a transitive dependency. Explicitly importing those transitive types seems to help, but that results in a bunch of unused imports, which is undesireable. I've had some success fixing it by doing two things: (1): Installing ts-common as a top level dep that's the same version as all transitive dependencies on it. (2): Reinstalling to allow npm to "dedupe" the package. This makes sure imports to ts-common resolve at the top level rather than transitively. However, with using lerna, deduping doesn't appear to work. But to make things even more confusing, this error cropped up only in tron-payments, but not in stellar-payments. Even though they're using identical package versions and similar imports. Then I stumbled across microsoft/TypeScript#29808 which describes a very similar issue. I ended up trying this commentors solution microsoft/TypeScript#29808 (comment) and that appeared to fix the issue. This isn't a perfect solution, but it's the best I've found. Ideally typescript should always generate portable declaration files, or at least resolve to the top level module when installed.
- Loading branch information