fix: remove static interface and use emitted instead [RFC] #395
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.
tl;dr;
remove statically typed interfaces as they do more harm than help
I've spend quite some time today fighting with types, and in the end it turned out the inaccurate types come from here.
In utilities we define interfaces which are implemented in classes.
(In my eyes) this only makes sense when the interfaces are reused and multiple classes implement the same interface.
In this case though each interface is only implemented once and in some cases they are incomplete.
This imo is a bit unreasonable and a self created maintenance burden.
Instead of using the
PoolInterface
you can just use the emittedPool
type and instead of specifying the return type you can infer it.setUsageAsCollateral
for example does not always return a promise, but can return a promise<extendedTxn[]> orextendedTxn[]
.Wdyt? Should we drop the manually maintained interfaces?