Skip to content

Instantly share code, notes, and snippets.

@obaranovskyi
Last active January 17, 2022 06:35
Show Gist options
  • Save obaranovskyi/db3afcb8e790e2934c94ef08a34cffa6 to your computer and use it in GitHub Desktop.
Save obaranovskyi/db3afcb8e790e2934c94ef08a34cffa6 to your computer and use it in GitHub Desktop.
/** @deprecated use User class instead */
class OldUser {}
class User {
/** @deprecated */
constructor(public username: string, public age: number) {}
/** @deprecated */
static createUser(username: string, age: number) {
/* ... */
}
static create(username: string, age: number) {
/* ... */
}
}
const oldUser = new OldUser();
const user1 = new User('John', 34);
const user2 = User.createUser('John', 34);
const user3 = User.create('John', 34);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment