We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
When streaming ledgers with typescript the sdk says to expect CollectionPage, however the value received is just the ledger record
Makes it so have to type assert to LedgeRecord in order to use the value properly
What version are you on?
@stellar/stellar-sdk@^12.0.0-rc.2"
To Reproduce
import { Horizon } from "@stellar/stellar-sdk"; const streamTest = async () => { const horizon = new Horizon.Server("https://horizon-testnet.stellar.org"); horizon .ledgers() .cursor("now") .limit(200) .stream({ onmessage: async ( msg: Horizon.ServerApi.CollectionPage<Horizon.ServerApi.LedgerRecord>, ) => { console.log(msg.closed_at); // throws error that .closed_at does not exist }, }); }; streamTest();
In order to resolve have to do:
const streamTest = async () => { const horizon = new Horizon.Server("https://horizon-testnet.stellar.org"); horizon .ledgers() .cursor("now") .limit(200) .stream({ onmessage: async (msg: any) => { console.log((msg as Horizon.ServerApi.LedgerRecord).closed_at); }, }); }; streamTest();
Trying to declare the param as LedgerRecord like so:
msg: Horizon.ServerApi.LedgerRecord
throws an error at compile time
Expected behavior
The onMessage value type should be LedgerRecord
The text was updated successfully, but these errors were encountered:
Shaptic
No branches or pull requests
Describe the bug
When streaming ledgers with typescript the sdk says to expect CollectionPage, however the value received is just the ledger record
Makes it so have to type assert to LedgeRecord in order to use the value properly
What version are you on?
@stellar/stellar-sdk@^12.0.0-rc.2"
To Reproduce
In order to resolve have to do:
Trying to declare the param as LedgerRecord like so:
throws an error at compile time
Expected behavior
The onMessage value type should be LedgerRecord
The text was updated successfully, but these errors were encountered: