Use TypeScript types for check in methods

I have this in my meteor.d.ts file:

declare function check<T extends Match.Pattern>(value: any, pattern: T): asserts value is Match.PatternMatch<T>;

which I think does what you want:

Edit: actually this type defintion for check is also in node_modules\@types\Meteor\globals\check.d.ts - have you installed that package? (the only reason I have it in my meteor.d.ts file is because I’ve replaced the default method with my own which takes a 3rd errMsg parameter).

Just FYI if you’re migrating to TS, these wrappers I provided for Methods and Publications might be useful.

There are other, probably better solutions out there, but these provided an easy migration path when I implemented them.