Skip to content

Instantly share code, notes, and snippets.

@fkmhrk
Created December 31, 2014 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fkmhrk/9981ff4686ba2921f747 to your computer and use it in GitHub Desktop.
Save fkmhrk/9981ff4686ba2921f747 to your computer and use it in GitHub Desktop.
TypeScript overload
module demo {
export interface App {
// ノンブロッキングAPI。callbackで結果を受け取るので結果はany
login(username:string, password:string, callback:LoginCallback);
// ブロッキングAPI。この場合はUserオブジェクトを返したい
login(username:string, password:string) : User;
}
export class AppImpl implements App {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment