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

Use message properties returns Api.Type* instead Api.* Is any automatic type conversion or methods to take concrete type #639

Open
aam1go opened this issue Feb 12, 2024 · 0 comments

Comments

@aam1go
Copy link

aam1go commented Feb 12, 2024

Need some help with using object properties in gramjs.

Have message:
const message = event.message;
For example, I want to get photo from this message contains photo. Using:

const photo = message.photo; // Expect type Api.InputPhoto, but returns Api.TypeInputPhoto.
//I can use "as Api.InputPhoto"
const photo = messages.photo as Api.InputPhoto;

but if I need to go deeper into properties. I should cast Api.Type* -> Api.* everywhere.
Is any decision without type casting?

@aam1go aam1go changed the title Use message properties returns Api.TypeInputPhoto instead of Api.InputPhoto for example. Use message properties returns Api.Type* instead Api.* Is any automatic type conversion or methods to take concrete type Feb 12, 2024
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