fastify / fastify-vite

Fastify plugin for Vite integration
MIT License
888 stars 73 forks source link

TypeScript support #12

Closed calebeaires closed 3 weeks ago

calebeaires commented 3 years ago

This project is amazing. Would be great to have an example using typescript at both side: server and Vue 3

galvez commented 3 years ago

It's on the TODO — while the core will remain StandardJS, we'll provide types for everything.

Will update this ticket when it's covered. Thank you!

jfsiii commented 3 years ago

Is there any update on this? Both Fastify and Vite publish types, so I'd love to have them here as well.

Can we start with something now and improve it or are there other milestones before it can begin? I might be able to help out depending on what you need (if anything).

galvez commented 3 years ago

@jfsiii I'd very much welcome help from TypeScript experts willing to stitch up these missing bits. I'm focused on other areas of as I'm already dog-fooding it, but don't really use TypeScript in my own projects.

calebeaires commented 2 years ago

@galvez, hi! hope this issue is active!

dimitropoulos commented 1 year ago

@galvez would you accept a PR that converts this entire repo to native TypeScript (without any logical changes)?

rtritto commented 1 year ago

Any update?

@dimitropoulos please can you start a PR?

dimitropoulos commented 1 year ago

I am pretty willing to make such a PR, but I want to get an affirmative "go-ahead" from whoever would actually review/approve it before I start. I've been burned before with spending time converting a codebase to TypeScript just to later find that it's not a welcome change, so I always like to ask first.

rtritto commented 1 year ago

Ok

FYI @galvez

spaceemotion commented 12 months ago

Not sure if this is the right thread, but I saw https://github.com/fastify/fastify-vite/pull/118 incorporated into the v5 release, but the types don't get bundled as the package json still excludes them. Was this an oversight or intentional?

Edit: I just noticed that this also includes the new utils export.

paynecodes commented 11 months ago

Virtual modules aren't supposed to work in TS projects right?

galvez commented 11 months ago

You can eject all of them, refactor into TypeScript and then just make sure index.html and index.js are loading the TypeScript versions. This will be available out of the box in the next minor release, just want to make sure I have worked out all the kinks. If you do that and want to contribute your working setup as part of packages/fastify-react/virtual, that would speed up the process!

tvarwig commented 9 months ago

Any update / timeline on typescript support? @galvez looks like v6.0 will have typescript support for Jan 2024. Is that still on track? Thank you for all that you do.

galvez commented 9 months ago

We already have some stuff in dev waiting for a release, lots of new types etc.

Both @fastify/vue and @fastify/react will have TypeScript versions of its virtual packages in the next minor release.

I should find some time to prep over the week!

tvarwig commented 9 months ago

We already have some stuff in dev waiting for a release, lots of new types etc.

Both @fastify/vue and @fastify/react will have TypeScript versions of its virtual packages in the next minor release.

I should find some time to prep over the week!

Sounds good! I will take a look.

gardevgranade commented 7 months ago

Anything new here?

aleksanderwalczuk commented 7 months ago

I'd also be pleased to know when it's going to be released.

onlywei commented 5 months ago

With this plugin, I can't figure out when I'm supposed to use tsc to compile my server code. The docs just say to use node server.js to run it, but I have server.ts. Does anyone have an example of some working package.json scripts using this plugin while writing the both the browser code and the server code in TypeScript?

Jayllyz commented 4 months ago

Any news?

onlywei commented 4 months ago

It was difficult for me to figure out how to use @fastify/vite with TypeScript. Especially how to organize the code, the two separate tsconfig.json files, and when to call tsc vs vite build. Through a lot of trial and error I have arrived at this solution.

Please browse through and read the code to see what I did. I hope it is helpful to you:

https://github.com/onlywei/fastify-vite-typescript-boilerplate

c.c. @mattkrins @admenmod @piotrgrundas @calebeaires

galvez commented 3 weeks ago

Closing this issue as we now have a working TypeScript example for reference.

Future versions of @fastify/vite will be written in TypeScript itself further improving support.