Created
January 16, 2019 10:30
-
-
Save tswistak/4c2f45452ca0ed762b7d51442b422ef4 to your computer and use it in GitHub Desktop.
Avoiding any in TypeScript, listing 5
This file contains hidden or 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
| class Settings { | |
| setting1: boolean = true; | |
| setting2: string = ''; | |
| setting3: number = 1; | |
| constructor(obj: Partial<Settings>) { | |
| Object.assign(this, obj); | |
| } | |
| } | |
| const obj = new Settings({ setting3: 2 }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment