I\'ve got a typescript class:
class ContactModel {
public getUsage(type: string): restangular.IElement {
return this.getBase().one(\'usages\', type);
JavaScript doesn't do runtime type information, so you have to do overload disambiguation yourself. Note that in the example in the Handbook, there's only one function implementation, whereas you have two.
class ContactModel {
public getUsage(type: string): restangular.IElement;
public getUsage(customerId: number, type: string): restangular.IElement;
public getUsage(typeOrCustomerId: string|number, type?: string): restangular.IElement {
if (typeof typeOrCustomerId === 'string') {
// First overload
return this.getBase().one('usages', type);
} else {
// Second overload
return this.ModelFactory.createRequestMapper(ContactModel.options)
.one('customers', customerId).all('contacts/usages', type);
}
}
}