Open danazkari opened 3 years ago
Hi @danazkari, nice that you like the project! I myself am not very familiar with TypeScript. What is necessary to support it? I thought that you could include JavaScript modules in TypeScript without any problems.
Yup essentially you can... But since it's typed, when you want it needs to know about the types the module has, and since you create a new extendable class out of observeState
function, it doesn't know what type of class you're returning.
I can add on my project a file to support the lib but since I have to do it anyways, might as well do it right and contribute to the project 😉
https://github.com/DefinitelyTyped/DefinitelyTyped#how-can-i-contribute
Basically there are two ways, one to add the file to your project or the better way I think, which would be to contribute to DefinitelyTyped which gives people to optionally add the typings only if needed.
A way to start working on this is to use perhaps scaffold a TS project with open-wc/open-wc-starter-app, import gitaarik/lit-state and then complete the lit-state.d.ts
file until it runs properly.
I could avoid using TS altogether but it would really help me to use it on this project I'm working on.
Hey @danazkari,
Looks interesting. As I said, I am not familiar with TypeScript, so I would have to learn these concepts before I understand what exactly is needed. I am interested in it, but my time is limited, and I can't promise you that I can fix this any time soon. If you are interested, you can of course maybe make a pull request to fix the issue. In the meantime, I will try to learn more about TypeScript.
Hey @danazkari,
Looks interesting. As I said, I am not familiar with TypeScript, so I would have to learn these concepts before I understand what exactly is needed. I am interested in it, but my time is limited, and I can't promise you that I can fix this any time soon. If you are interested, you can of course maybe make a pull request to fix the issue. In the meantime, I will try to learn more about TypeScript.
Yeah man it's all good, take ur time, I'm using the ticket as notepad, I wasn't expecting you to work on this actually, but rather I'd like to donate a bit of my time for the project with this 😁
Cheers!
Ok cool. I'm excited to see the progress on this :).
@danazkari Did you create the types? Can you share them with me?
@danazkari Did you create the types? Can you share them with me?
Hey! I'm really sorry mate but I wasn't able to, didn't find the time to do it
Early preview of a TS state manager for lit: https://github.com/lit-apps/lit-app/tree/main/packages/state.
Not yet released to npm
Nice work!
@gitaarik - Yes, thanks ; )
I will slowly transition to this new approach in our apps (for instance accessiblesurveys.com), mostly for better TS support. But I had loved lit-state - thanks a lot for it and all the apprecitated work around it !
Thank you, also for your contribution :)
Hello! I love the simplicity of this project and was about to use it, but I was trying to use typescript and it seems like
lit-element-state
does not support typescript.Can support be added? Can I help do it?