I know of 2 ways that are not very convenient and look inelegant:
-
Via then:
(new TestClass).syncMethod().asyncMethod().then(self => self.anotherSyncMethod())
-
Via await:
(await (new TestClass).syncMethod().asyncMethod()).anotherSyncMethod()
I expect it to be something like this (pseudocode):
(new TestClass).syncMethod().asyncMethod()->anotherSyncMethod()
where ->
is the transition from an async method to a synchronous one.
Is there something like this in JS, and if not, is there any plans for it in the future?
0
There is not.
However, the proposed pipeline operator might enable this in the future. You can find some bikeshedding in disussions there, like in issues #53, #86, #145, #189.