Best way to incrementally move to typescript #12521
Replies: 5 comments
-
I used to use a mix of JS+Flow on a project but since switched to a mix of JS+TS using the built-in Meteor Typescript compiler. No issues incrementally converting. Here's my tsconfig.json if that is useful to you. Not sure if it's all best practices but it works for me :)
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Yeah, you're right, I only needed the tsconfig for VSCode usage. As for your compilation problem, have you creating a minimal typescript starter project based on the builtin templates ? And then seeing if you can rename a js to a ts? |
Beta Was this translation helpful? Give feedback.
-
If that's of any help, I've created a template for meteor projects here https://github.com/chneau/meteor-template This allows declaration of methods this way export const mutateLinkUpdatedAt = new TypedMethod({
name: "links.mutateLinkUpdatedAt",
async run(linkId: string) {
return await LinksCollection.updateAsync(linkId, { $set: { updatedAt: new Date() } });
},
}); And it's making life easier when importing this method from another file, calling it this way: |
Beta Was this translation helpful? Give feedback.
-
Ok this was problem with my local setup. I thought it was more general problem than what it ended up being |
Beta Was this translation helpful? Give feedback.
-
I have been using Meteor for a while in a fairly big project and I'm looking to move it over to typescript.
My project is fairly big and I've been using flow-type https://github.com/facebook/flow but typescript has some additional benefits that would be nice to utilize.
I am trying to move this stuff over one at a time just because all at once would be too much.
I have tried a few of the different packages and can't quite figure out how to make them work with only compiling a few files
if I try the normal typescript package it doesn't read the tsconfig so I can't make my dynamic paths work which is a must for my repo
adornis:typescript seemed to be the closest to me, but I could not get babel-module-resolver to work, and it had some other issues as it has been deprecated for a few years
refapp:meteor-typescript has the problem that is trying to run the ts compiler on all of my files which complains because of all my flow annotations and its generating the files in the source folder so its really cluttering my git with generated files.
It would be great if there was an easy way to have just a few files be typescript so that we can slowly convert the whole project. If there is a solid way to do it could some one point me to some resources?
Beta Was this translation helpful? Give feedback.
All reactions