Skip to content

Instantly share code, notes, and snippets.

@wmathes
Last active October 20, 2016 09:15
Show Gist options
  • Save wmathes/bd0317709ebf982c2eb6fd215c409540 to your computer and use it in GitHub Desktop.
Save wmathes/bd0317709ebf982c2eb6fd215c409540 to your computer and use it in GitHub Desktop.
class ServiceNode {
constructor(protected client: HttpApiClient) {
}
}
class Service {
protected client: ServiceClient;
constructor(config: string | ServiceClient) {
if (typeof config === "string") {
this.client = new ServiceClient(config as String);
}
else if (!(config instanceof ServiceClient)) {
throw new Error("Requires an instance of ServiceClient or a string containing the services baseUrl");
}
else {
this.client = config as ServiceClient;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment