Closed lpellegr closed 3 years ago
@marlon-tucker, what do you make of this? I don't understand how @lpellegr was able to import types with import {AsyncMethodReturns, Connection, TCallSender, connectToParent} from 'penpal';
@lpellegr, can you still import connectToParent
with this: import { connectToParent } from 'penpal';
@lpellegr, can you still import connectToParent with this: import { connectToParent } from 'penpal';
Yes, this is still possible but no longer AsyncMethodReturns, Connection and TCallSender.
I don't understand how @lpellegr was able to import types with import {AsyncMethodReturns, Connection, TCallSender, connectToParent} from 'penpal';
I'm equally confused, I checked out tag 5.1.1 and built it, and the index.d.ts
looks the same as it is in 5.2.0.
I hadn't realized the package.json
file didn't have a types
entry before 5.2.0, and I'm not sure what Typescript falls back on if it doesn't find that entry - I would expect it's something to do with that.
Although saying that, in our code we have import { Methods, AsyncMethodReturns } from 'penpal/lib/types';
which is what the language service auto imported.
@marlon-tucker How do you import Connection? I don't see it exported in penpal/lib/types
.
That has been something I've been meaning to submit a PR for actually.
Both the return types for connectToParent
and connectToChild
are not exported, which meant we couldn't store the result as a strongly typed class member (we needed to keep track of it so we could dispose it properly in the future).
I hacked around that by defining a interface with a destroy
function.
I just noticed you also seem to be importing TCallSender
? That's a generic type argument for the connectToParent
function, so that should have never been importable.
But to answer your question we don't import Connection
currently, but we would if we could.
@marlon-tucker, a PR for Connection
would be great! I'm going to close out this issue and create a new one for Connection
.
Using Penpal 5.1.1, I was importing types and defining variables in a TypeScript project as follows:
Unfortunately, using Penpal 5.2.0, I cannot find the equivalent.
It seems TCallSender was replaced by CallSender and most types need to be imported from the lib folder:
My main issue is about Connection which seems not exported. How to import it?