Typescript definitions

I find typescript quite confusing so I’m still not really sure how to resolve some typescript warnings.

Do I need to create a .d.ts file declaring some of these types?
These are some of the warnings i’m getting:

I get this when trying to access the string from a mongo objectID:

Property '_str' does not exist on type 'ObjectID'

I’m using a function from the numeric library which gives me the following warning:

Cannot find name 'numeric'

And a few other warnings but if someone could help me solve these i’m sure I could use that to fix the others

1 Like

Same problem. I have found Meteor TypeScript support somewhat lacking. In this case, however, given underscore in the name, _str is probably a private property not meant to be an exposed API, in which case it shouldn’t be in any published typings. That said, how are we to generate string-based ids for Mongo subdocuments if we don’t have access to the property?

Regardless, if you have the @types/meteor typings installed, you should be able to merge the property into the relevant interface by including by including the following in a global type definitions file in your project:

declare module 'meteor/mongo' {
	module Mongo {
		interface ObjectID {
			_str: string;

Same trouble! Any advice? :cry:

Did the typings I provided in the previous message not work for you, @sehengratis? They solved the problem for me. You should be able to just include or reference that module declaration in the typings.d.ts file.