Meteor 2 TypeScript type definitions?

The README on the @types/meteor type definitions states that they are for Meteor 1.4. I’ve continued to use those typings with our Meteor 2 project with integrated TypeScript support, but found that versions of @types/meteor after 1.4.72 produce transpilation errors: TS2694: Namespace 'React' has no exported member 'DependencyList'. What TypeScript typings should be used with Meteor 2?

I think in Meteor v2, you just add the typescript package and it’ll work:

meteor add typescript

That is strange, React should not be in the typings at all as that is a… react thing.

1 Like

Thanks, @minhna. While we use the Meteor TypeScript package for transpiling our server code, we are sharing some code in a monorepository with projects transpiled by tsc and linted by @typescript-eslint. While the server will run without @types/meteor, the built-in typings I then get on our METEOR@2.2.1 project are reported as /** Meteor version 1.3.1 **/. Further, without using @types/meteor, I don’t see how to properly type and lint shared code when it refers to Meteor types. Finally, initializing a project with meteor create ProjectName --typescript automatically installs @types/meteor, making it look like these are the correct typings for the Meteor TypeScript package.

As I seem to be the most active maintainer of @types/meteor, let me answer this one. Yes, there is such a comment in the README.md and yes, the version says 1.4.x. We haven’t focused on that, as they are technically backward compatible (more or less; we do add new features though).

I’d love to update it and make it actually in-align with the Meteor versioning, however, I don’t have that much time to do it now. @types/react has some sort of versioning, but it’d require additional setup (and tooling).

And yes, the typescript package is there just to make Meteor understand TypeScript files – it has nothing to do with @types/meteor.


About the DependencyList issue - I haven’t seen that and I’m using these typings in a couple of projects. I guess it may be connected to this line. Can you check whether what version of @types/react are you using?

1 Like

Thanks for the reply, @radekmie.

We’re not using and have never used @types/react since we have no React dependencies. Our front end is Angular, built with Angular CLI, not Meteor.

If @types/meteor depends on @types/react, shouldn’t the latter be a declared dependency of the former? I only see @types/mongodb in @types/meteor package.json.

I have been looking for a way to get the .d.ts files from meteor packages into a place where e.g. VS Code can make use of them. Got stuck though. See Attempt at getting .d.ts files in meteor packages to be usefull

Well… That’s a bug. Could you file an issue in the DefinitelyTyped repo, @ me and link this issue? I’ll try to get to that this week. Of course, if you’d like, go ahead and file the PR straight away – I’ll get notified automatically.

I saw that, but haven’t got time to check the possibilities there. On one hand, I thought about a similar approach, but I’m not a fan of modifying node_modules. On the other, I thought about some “less automated” way of doing that… In any case, I have a couple of ideas written down and I’ll get to them soon. Will keep you posted!

Thanks, @radekmie. Per the DefinitelyTyped guidance on single package bug reports, I’ve opened a discussion on this missing dependency.