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 support #95

Open
lamorak13 opened this issue Mar 23, 2023 · 11 comments
Open

Typescript support #95

lamorak13 opened this issue Mar 23, 2023 · 11 comments

Comments

@lamorak13
Copy link

Are there plans to also support typescript?

@vkurko
Copy link
Owner

vkurko commented Mar 24, 2023

Yes, someday I will definitely add typescript support. Unfortunately, I can't give an estimate right now. Any help on this matter is welcome 😄

@ksmoore17
Copy link

ksmoore17 commented May 2, 2023

I have made progress on this. I switched the svelte packages to use svelte-package instead of rollup. I think this is a straight upgrade (as far as svelte support) from rollup, following svelte's/sveltekit's near-full migration to vite. In common, I have added some jsdoc and generated ambient types as well as manually created types for Resource, Options, Duration, Plugin and others. I tried to leave the internals mostly alone, but I made a few small changes like removing the assign utility function, for example (wasn't working nicely with typing). I also added a simple demo site for the svelte component.

I originally was planning on just forking and maintaining my own publication, so I have made some other changes like using pnpm with workspaces, removing rollup/publishing from the top level, adding a GitHub workflow, and adding a linter/formatter. However, I found I didn't really want to mess with the internals (common), so I ended up just doing as much jsdoc as I could on top of your source thinking maybe merging would be possible. I hope at least you can find some use in the typing that I have added if merging seems like a problem. Let me know if you would like me to make a pr. I took out the scripts for versioning and publishing because I wanted to do that with changesets but never got around to it (or changing it back).

I'd like to look into styling in the components instead of importing the scss stylesheet in Calendar. I think another improvement would be to migrate docs (especially the Options object) into jsdoc and generate from there.

Thank you for creating this package! You can see my fork here

@vkurko
Copy link
Owner

vkurko commented May 3, 2023

@ksmoore17 Thanks for starting this change. I looked at the result and it's impressive. I see value for the upstream repository in the types you defined here.

I would not like to use jsdoc as an intermediate solution, but go straight to typescript. And I would not want to accept all your changes, because there are so many of them. Maybe the right way is a smooth transition to typescript by rewriting individual functions and components? So that no more than a few files get into the pull request at a time and for them it is possible to carefully do a code review?

@ksmoore17
Copy link

ksmoore17 commented May 3, 2023

@vkurko Makes sense and sounds good to me. I will start rewriting common in ts. How do you feel about the repository-level changes: workspaces, using svelte-package in the svelte subpackages (including building within all the individual packages), GitHub workflow for publishing?

@vkurko
Copy link
Owner

vkurko commented May 3, 2023

  • GitHub workflow - If it works as well as the current tool, then why not. Although it's not difficult for me to npm run publish when a new release is ready.
  • Workspaces - I'm not sure I understand what it's about. Can you explain?
  • svelte-package - It's from SvelteKit, right? I don't really see much point in using SvelteKit to develop the library. Maybe I don't know about some advantages that SvelteKit provides when working on a library, and not on a website. What will be the benefit?

More thoughts on typescript. Perhaps I was in a hurry with the fact that the entire project needs to be rewritten in typescript. After all, Svelte and SvelteKit projects that will use the Event Calendar will use the source files of the library. And if the project does not use typescript? It turns out an extra dependency that can limit the use of the library. I would like to avoid such a situation.

@kryptus36
Copy link

kryptus36 commented Jun 19, 2023

Don't overthink this.

  1. If you rewrite in typescript it doesn't force consumers of your lib to use it (the conversion to pure js will be done as part of your build/publish steps).
  2. If you don't want to rewrite in TS simply supply the .d.ts files with your code

Option 2 is probably harder to maintain long term.

Great project! I hope you add ts support soon.

@vkurko
Copy link
Owner

vkurko commented Jun 19, 2023

Don't overthink this.

Yeah, my concern was about Svelte/SvelteKit projects that use the library's source code. But after some research, I realized that it is possible to get pure JS Svelte source files as a result of compiling Typescript source code.

@erskingardner
Copy link

Any updates on this?

@vkurko
Copy link
Owner

vkurko commented Dec 14, 2023

Unfortunately, nothing was done on this task.

@ksmoore17
Copy link

I'm sorry.. the fullcalendar model with the options object ended up not working for me, so I lost interest.

@Fernando-lamas
Copy link

Fernando-lamas commented Feb 22, 2024

Is there an update on this? I am quite interested in using this. ts support is a necessity for my use case

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

6 participants