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 types for state and other properties #141

Closed
jimmycrequer opened this issue Mar 3, 2022 · 1 comment
Closed

Add types for state and other properties #141

jimmycrequer opened this issue Mar 3, 2022 · 1 comment

Comments

@jimmycrequer
Copy link

Thanks for providing this very convenient library !

I found out about this issue mentioning about the state property, holding the eventQueue array.

When I printed out the object to see the available properties, I found out that a lot of them weren't declared in the type :

Screenshot from 2022-03-03 15-15-12

My goal is to simulate a game dialog behavior where clicking on a message being typed out would just show it entirely.
For this purpose I am clearing the eventQueue manually to remove all pending events and write out the whole message at once.

https://jsfiddle.net/eszvo40g/1/

However, Typescript complains because state is not defined in the TypewriterClass class. My workaround is currently to extend the type by myself :

type TypewriterClassExtended = TypewriterClass & { state: { eventQueue: [] } };

Would it be possible to add all missing properties in the TypewriterClass class?

@tameemsafi
Copy link
Owner

The state object is supposed to be private therefore should not be included in the external types. This is because it may change in the future.

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