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

Typescript and framework integration #73

Open
tleperou opened this issue Feb 9, 2023 · 4 comments
Open

Typescript and framework integration #73

tleperou opened this issue Feb 9, 2023 · 4 comments

Comments

@tleperou
Copy link

tleperou commented Feb 9, 2023

Is your feature request related to a problem? Please describe.
For those working with typescript, integrating Swiffy-slider requires some work. In my case, the builder.io Qwik framework but it applies to any others like Remix.

Describe the solution you'd like
Make Swiffy-slider Typescript friendly and/or submit a type in @types/* repo

Describe alternatives you've considered
There isn't much alternative.

Additional context
Using the reference of window shall eventually be reconsidered in order to make the integration within other frameworks easier.


I've already worked on it and got a simple Typescript support.

If interested, I would create a new branch using this issue's ID.

@nicped
Copy link
Member

nicped commented Feb 9, 2023

Thank you for supporting and taking Swiffy Slider for a spin.

I have little experience with TS so I cannot say much here.

Swiffy Slider comes in classic JS that can be included in script tags or you can import it as an ESM.
The latter is supported in TS as far as I can tell:
https://www.typescriptlang.org/docs/handbook/esm-node.html

I am a huge fan of simple things and following standards. It is fine to add TS support - but if it requires complexity and going away from standards, I might not be in favor. Feel free to create a pull so I can see the implications.

Thanks, Nicolai

@chimok
Copy link

chimok commented Feb 2, 2024

@nicped You don't need to change your code. You (or someone else) could simply create a new package @types/swiffy-slider with the type definition only. The advantage with typescript is, if you transpile your code the type definition is generated automatically.

Anyway. I like simple things too. Instead Typescript i prefer for small scripts just jsdoc, that is sadly missing in your code and could be helpful. VSCode supports it and use it for linting too.

@nicped
Copy link
Member

nicped commented Feb 6, 2024

I can go with adding the JSDoc - as they are minified away and does not come with any requirements. Even though the comments pollute the src code :-)

I am either too smart or not smart enough to add TS types.... Your call!. But feel free to create a package,.

@tleperou
Copy link
Author

tleperou commented Feb 6, 2024

👍 on adding JS doc. I'll be available only in a couple of weeks before getting into it

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

3 participants