question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Type errors in state change subscriptions upgrading to 2.0.1

See original GitHub issue

Hi there, I’m using state services with the includeStateChangesOnSubscribe: true setting, and after updating to the latest version, my project isn’t building and all of the subscriptions are showing type errors. Since I was using includeStateChangesOnSubscribe: true, in each subscription I was using the separate state and stateChanges objects as so: this.fooStateServiceSubscription = this.fooStateService.stateChanged .subscribe(stateEvent => { if (stateEvent.stateChanges.pages) { this.allMyPages = stateEvent.state.pages; }

The compiler now thinks that the stateEvent object dispatched through the description is the state type itself, not the js object that had state and stateChanges on it.

I could go into all of these spots and cast the stateEvent object to any, but that seems rough. Is it possible to ratchet back down the type safety of the dispatched state event object, or somehow make an interface that would work for both versions?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
MichaelTurbecommented, Oct 22, 2019

I think that’s the ideal solution.

0reactions
DanWahlincommented, Oct 25, 2019

I just released 2.1.0 which now has stateWithPropertyChanges. The includeStateChangesOnSubscribe property is now deprecated buts works the same as in the initial 2.0.0 release. I’ll keep it in there up through a 3.0 release. The readme has details about the new observable properties. See the version history for the specifics for 2.1.

Thanks for your feedback!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lots of error messages like: ` Cancelling subscription, and ...
Lots of error messages like: Cancelling subscription, and marking self as failed with Invalid StartingSequenceNumber since upgrading to 2.0 # ...
Read more >
Upgrading operator subscriptions - IBM
Procedure. Complete the following tasks to update the relevant operator subscriptions on your cluster: 1. Updating the scheduling service operator subscription.
Read more >
Upgrading the major version of an Amazon Aurora MySQL DB ...
Upgrade between Amazon Aurora MySQL major versions for a DB cluster. ... That way, the cluster volume is still identical to the state...
Read more >
Sell subscriptions | Google Play's billing system
A purchased subscription can go through various state changes throughout its lifecycle, and your app needs to respond to each change.
Read more >
Pre- and post-upgrade tasks for various products
In preparation for your upgrade, review the upgrade and migration tasks for various applications and features. Plan to complete these tasks, when applicable ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found