Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TypeScript support for "Import post-me as a script" #62

Open
ChrisTorng opened this issue Sep 1, 2021 · 4 comments
Open

Add TypeScript support for "Import post-me as a script" #62

ChrisTorng opened this issue Sep 1, 2021 · 4 comments

Comments

@ChrisTorng
Copy link

Is your feature request related to a problem? Please describe.
I'm using "Import post-me as a script" way, on TypeScript. But can't find a built in way to code strong type in TypeScript.

Describe the solution you'd like
I add a new export_post-me.d.ts as:

export * from '../lib/post-me/dist/index';
export as namespace PostMe;

Then I can new PostMe.WindowMessenger() object, or get PostMe.RemoteHandle type.
I suggest post-me to include export as namespace PostMe, and add description in README.md. Let new comer like me spent less time try to find the right way.

Describe alternatives you've considered
I have no other way to make post-me strong type, except any. If you have a better way to make TypeScript happy, I'm glad to know. And still hope to add description in README.md too.

Additional context
No.

@alesgenova
Copy link
Owner

Hey thanks for opening the issue!

I'm not familiar with consuming the library as a script in a TypeScript context, so I don't quite understand the instructions above.

Can you give me some more step by step instructions?

Once I understand how to fix/document the issue, I'll be happy to make the necessary changes to post-me to cover this use case

@ChrisTorng
Copy link
Author

ChrisTorng commented Sep 2, 2021

I added https://github.com/ChrisTorng/PostMeTypeScript to show the problem and the fix of mine.

@ChrisTorng
Copy link
Author

Sorry I fix the link of previous post to https://github.com/ChrisTorng/PostMeTypeScript.

@alesgenova
Copy link
Owner

Thanks for the example, I'll open a PR to update the docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants