Created
August 17, 2020 01:04
-
-
Save igorjs/6c332091daa8cf6323539c05b018bff1 to your computer and use it in GitHub Desktop.
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
interface IXOptions { | |
a?: string, | |
b?: any, | |
c?: number | |
} | |
const XDefaults: IXOptions = { | |
a: "default", | |
b: null, | |
c: 1 | |
} | |
export class ClassX { | |
private options: IXOptions; | |
constructor(XOptions: IXOptions) { | |
this.options = { ...XDefaults, ...XOptions }; | |
} | |
public printOptions(): void { | |
console.log(this.options.a); | |
console.log(this.options.b); | |
console.log(this.options.c); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment