Closed SkeLLLa closed 5 years ago
@kinwa91 fyi there's a workaround to deal with this. First of all you need to cast result of function that suppose to return Promise to unknown type, and then convert it to type that actually should be returned. Example:
const tmp = plugin.topic.subscription(subName);
const [sub] = (<unknown>await tmp.get(
{
autoCreate: true,
},
undefined
)) as [Subscription];
But obviously it should have proper typings.
Yes, but I recommend that you use v0.22.0 for now that doesn't contain types information, while we finish up with converting to TypeScript. Thanks for your patience!
@kinwa91 Doesn't v0.22.0 in fact contain type information?
Greetings! We've done the initial conversion to TypeScript, but it is no way close enough to have high fidelity types. We're tracking actually turning type hinting on in #141 :)
All methods that could return Promise have invalid typescript signatures.
For example,
createTopic
:First of all there's no override with Promise returned, but it should be. But for now usage of this lib in typescript is not possible with Promises or async-await, because
The second thing -
gaxOpts
should be optional. And it would be good if it have proper interface, not justany
.Environment details
@google-cloud/pubsub
version: "0.21.1"Steps to reproduce
Sample: