Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using type generics with the StacksTransactionWire type #1776

Open
aryzing opened this issue Dec 17, 2024 · 0 comments
Open

Consider using type generics with the StacksTransactionWire type #1776

aryzing opened this issue Dec 17, 2024 · 0 comments
Labels
feature Brand new functionality. New pages, workflows, endpoints, etc.

Comments

@aryzing
Copy link

aryzing commented Dec 17, 2024

Problem

Different transaction types often require dedicated code. However, even after checking the payload type, the payload needs to be kept in its own variable to preserve any type checks or assertions. There is no way to assert that a transaction has a given payload type

Solution

Introduce generics for transaction types. Something like

type StacksTransactionWire<TPayload = PayloadWire> = {
  payload: TPayload
  // ... other props
}

This would allow typing a given transaction's payload (and possibly other internal structures) without having to keep them as separate variables.

@aryzing aryzing added the feature Brand new functionality. New pages, workflows, endpoints, etc. label Dec 17, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in DevTools Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Brand new functionality. New pages, workflows, endpoints, etc.
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant