TypeScript imports with Penpal 5.2.0
See original GitHub issueIssue Description
Using Penpal 5.1.1, I was importing types and defining variables in a TypeScript project as follows:
import {AsyncMethodReturns, Connection, TCallSender, connectToParent} from 'penpal';
protected parentConnection: Connection<TCallSender>;
protected parent: AsyncMethodReturns<TCallSender>;
this.parentConnection = connectToParent({...});
this.parent = await this.parentConnection.promise;
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:
import {AsyncMethodReturns, CallSender} from 'penpal/lib/types';
My main issue is about Connection which seems not exported. How to import it?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
penpal-es5 - npm
Penpal is a promise-based library for securely communicating with iframes via postMessage. The parent window can call methods exposed by iframes, pass arguments ......
Read more >penpal/package-lock.json at master - GitHub
A promise-based library for securely communicating with iframes via postMessage. - penpal/package-lock.json at master · Aaronius/penpal.
Read more >penpal: Versions - Openbase
Full version history for penpal including change logs. ... TypeScript types could previously (and still can) be imported through a child path as...
Read more >Importing images in TypeScript React - "Cannot find module"
I am trying to import images to use inside a React component with TypeScript. The bundler I'm using is Parcel (not Webpack).
Read more >Compare Versions | @teambit/changelog | npm
@babel/plugin-syntax-import-assertions 7.20.0 ... @teambit/typescript.modules.ts-config-mutator 0.0.76. remove. @teambit/ui 0.0.451 ... ansi-styles 5.2.0.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That has been something I’ve been meaning to submit a PR for actually.
Both the return types for
connectToParent
andconnectToChild
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 theconnectToParent
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 forConnection
.