typescript Parsing error: Unexpected token : code example

Example: parsing error unexpected token javascript

You have a misguided } character after the declaration of function1, just remove that character:

var myApp = myApp.factory("gMapService", ["$http", function($http) {
    var urlBase = "https://mymapservice.com/api/function/json";
    return {
        function1: function(arg) {
            return $http.get(urlBase, {
                cache: true,
                headers: {
                    "Content-Type": "application/json"
                },
                params: {
                    address: arg
                }
            })
                .then(function(resp) {
                    return resp.data;
                });
        }
    }
}]);