Typescript integration for Meteor packages #12080
Replies: 2 comments 11 replies
-
So I was actually giving this a bit of thought the other day myself and had very similar thoughts. Here was what I was thinking.
There are some some caveats here like the fact that npm sometimes overwrites the node_modules dir in its entirety. This is mitigated by using the CLI to re-copy the types using the postinstall script, and other projects such as Prisma are using this approach to have a dynamically generated api that lives in the node_modules dir. Hopefully this might give ideas that you might not have had yet. I'm very excited for this as this opens a whole realm of possibility for Meteor. One other thing we might do is document a best practice for setting up the a package to generate the type defs before publishing. Maybe this could even be a "beforePublish" hook for the meteor tool that specifies a command to run before the publishing "meteor": {
"mainModule": {
"client": "client/main.tsx",
"server": "server/main.ts"
},
"testModule": "tests/main.ts",
+ "hooks": {
+ "beforePublish": "tsc index.js --declaration --emitDeclarationOnly",
+ "afterPackageModification": "meteor-ts",
+ }
}, |
Beta Was this translation helpful? Give feedback.
-
Starting v2.8.1 Meteor now offers its own types thanks to zodern:types, see migration steps for more information. |
Beta Was this translation helpful? Give feedback.
-
Hi, as a part of the Vazco & Meteor Software cooperation, I've just started working on native TypeScript type definitions support for Atmosphere packages and I want to share with you some details.
Currently, packages installed with Atmosphere are missing type definitions. Even if a source code would have them, it won't be used in your IDE. For this reason, we use DefinitelyTyped to support Atmosphere packages with type definitions. My goal is to remove the necessity to use an external library and import all types, that will be provided with the source code, to the project. That will help to keep TypeScript types up-to-date and improve a developer's experience.
The roadmap looks as follows:
~/.meteor/packages
. I will create an external script that will copyindex.d.ts
from the package source code to the projectuniverse:i18n
tsconfig.json
index.d.ts
files in their main repository.d.ts
files in the package repositoryFeel free to comment and share your opinion.
References:
meteor/PACKAGE_NAME
imports as error? #6177Beta Was this translation helpful? Give feedback.
All reactions