1type ComponentConfig = {
2 optionOne: string;
3 optionTwo: string;
4 optionThree: string;
5}
6export class SomeComponent {
7 private _defaultConfig: Partial<ComponentConfig> = {
8 optionOne: '...'
9 }
10 @Input() config: ComponentConfig;
11
12 ngOnInit() {
13 const merged = { ...this._defaultConfig, ...this.config };
14 }
15}
Created on 3/19/2020