Problem with Typescript on the server side

On my server side, I created a simple Meteor method like this

// user.controller.ts

/// <reference path="../../typings/definitions/all-definitions.d.ts" />

Meteor.methods({
	"user.controller.register": function(email: string, password: string) {
		console.log(email);
	}
})

However, on the when I trigger the method calling from the client side, I got “404: Method not found”. I checked the final compiled js file and this is the one

(function(){

System.register("server/controller/user.controller", [], function(exports_1) {
    return {                                                           
        setters:[],                                                    
        execute: function() {                                          
            Meteor.methods({                                           
                "user.controller.register": function (email, password) {
                    console.log(email);                                
                }                                                      
            });                                                        
    }                                                              
    }                                                                  
});                                                                   
 
}).call(this);

and this is the part I don’t understand. I was thinking that the .ts file will be compiled to js line-by-line (or at least approximately like that). As in, final file should not have any line like “System.register…”. However, the compiled file has that and I think that on the server side, the “Meteor.methods” line is not triggered to add the new function definition to it

How can I overcome this issue ?

UPDATE:

please ignore this. problem is because I am using angular2-meteor package and I need to have the main.ts with some importing in order to load the module

I too am using angular2-meteor package, and can’t seem to be able to use any helper functions external to my methods.ts file, which I keep under a /common folder.

I tried importing the file (e.g. /common/helper.ts) in my main.ts file, or the actual class (e.g import {Helper} from './helper';) but nothing seems to work: either I get a method not found error on any method, or a Helper is unknown message.

Any idea how to get around this?
Thanks :slightly_smiling: