Closed ahtcx closed 5 years ago
I don't know much about TypeScript, but I'll take your word for it. Thanks for the contribution!
Published in 3.0.4. Thanks again.
These types don't work properly, and won't even compile by themselves. I'll submit some fixes w/ tests
Thanks @mike-north.
@mike-north How so? Everything is working on my end, with typescript@3.2.2
. Sorry if this broke something...
Everything is working on my end, with typescript@3.2.2. Sorry if this broke something...
Ambient types are really tricky to get right, since it's a set of constraints that must perfectly line up with the underlying code. Like anything, once you know how to test them, it's a lot easier to be confident around correctness.
If you're interested in learning more, here's the package we to test type declarations in DefinitelyTyped (all the @types/*
npm packages) and here's an article I wrote to help people new to .d.ts
files
https://medium.com/@mikenorth/guide-to-typescript-ambient-declarations-717ef6da6514
With generic types we can now have a strongly typed
IConnectionObject
promise. We can optionally define the types whilst callingconnectToChild
orconnectToParent
.If no type is provided it will default to
any
which is the current value so nothing will break.