Last active
January 17, 2022 06:35
-
-
Save obaranovskyi/db3afcb8e790e2934c94ef08a34cffa6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @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