Skip to content

Instantly share code, notes, and snippets.

@ssuperczynski
Last active November 5, 2018 18:08
Embed
What would you like to do?
export type Partial<T> = { [P in keyof T]?: T[P]; };
export interface DefaultConfig {
searchEnabled: boolean;
headerEnabled: boolean;
orderEnabled: boolean;
}
@Injectable()
export class TableService {
public defaultConfig: Partial<DefaultConfig> = {
searchEnabled: true,
};
}
export class TableComponent {
private additionalConfig: Partial<DefaultConfig> = {
headerEnabled: true,
orderEnabled: true,
};
ngOnInit() {
const config = { ...this.defaultConfig, ...this.additionalConfig };
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment