Skip to content

Instantly share code, notes, and snippets.

@igorjs
Created August 17, 2020 01:04
Show Gist options
  • Save igorjs/6c332091daa8cf6323539c05b018bff1 to your computer and use it in GitHub Desktop.
Save igorjs/6c332091daa8cf6323539c05b018bff1 to your computer and use it in GitHub Desktop.
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