You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is just for improving Typescript experience. There is no functional changes intended.
When working with Typescript, using Transition.params() usually feels a bit clunky. A piece of code to illustrate the issue:
lettoParams=transition.params();console.log(toParams.id);// Warning; "prop id does not exist on type.."console.log(toParams['id']);// ugly workaround
Both of the options above leaves the user with no intellisense in their editor. There is solution to the above, which is to cast params to interface/type, but this is messier (especially in one-liners):
lettoParams=transition.params()asMyStateParams;console.log(toParams.id);// yay!console.log((transition.params()asMyStateParams).id);// not very pretty...
Ideally, I would like to be able to do this:
lettoParams=transition.params<MyStateParams>();console.log(toParams.id);console.log(transition.params<MyStateParams>().id);// feels better than casting
The text was updated successfully, but these errors were encountered:
This issue is just for improving Typescript experience. There is no functional changes intended.
When working with Typescript, using
Transition.params()
usually feels a bit clunky. A piece of code to illustrate the issue:Both of the options above leaves the user with no intellisense in their editor. There is solution to the above, which is to cast params to interface/type, but this is messier (especially in one-liners):
Ideally, I would like to be able to do this:
The text was updated successfully, but these errors were encountered: