post-me
post-me copied to clipboard
Add TypeScript support for "Import post-me as a script"
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.
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
I added https://github.com/ChrisTorng/PostMeTypeScript to show the problem and the fix of mine.
Sorry I fix the link of previous post to https://github.com/ChrisTorng/PostMeTypeScript.
Thanks for the example, I'll open a PR to update the docs