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

Explicitly import types from @types/telegram-web-app #41

Open
IlyaSemenov opened this issue Oct 15, 2024 · 1 comment
Open

Explicitly import types from @types/telegram-web-app #41

IlyaSemenov opened this issue Oct 15, 2024 · 1 comment

Comments

@IlyaSemenov
Copy link
Contributor

vue-tg implicitly refers to telegram-web-app types but doesn't explicitly import (let alone re-export) them.

This leaves user apps partially untyped, for example:
image

which is caused by referring to an unresolved type in vue-tg typings:
image

Note that the library's dependencies are not transitive in many environments, e.g. when using pnpm. Listing @types/telegram-web-app as the dependency of vue-tg doesn't automatically make it available in user's project.

Expected

vue-tg explicitly imports all types that it depends upon (this way, they will be picked by vite build / rollup and will be properly referred in dist/*.d.ts).

Better yet, vue-tg additionally explicitly re-exports main involved types such as WebAppInitData, so that they could be consumed by users without having to install @types/telegram-web-app and manage dependency versions on their own.

@IlyaSemenov
Copy link
Contributor Author

I figured it's harder than I thought... @types/telegram-web-app pollutes the global namespace and apparently can't be directly imported. But then it's probably should be at least documented, otherwise as I elaborated above users end up with partially untyped code.

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

1 participant