Skip to content

Commit ea83091

Browse files
Ashleighbashleigh
authored andcommitted
Made config parameter on Config object optional
1 parent 51fbdef commit ea83091

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/__tests__/config.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,8 @@ describe('Config object', () => {
5252
}),
5353
).toEqual({ eighth: true });
5454
});
55+
56+
it('Can instance without parameters', () => {
57+
expect(new Config()).toBeInstanceOf(Config);
58+
});
5559
});

src/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export class Config {
77
/**
88
* @param config
99
*/
10-
constructor(config: {[s: string]: any}) {
11-
Object.keys(config).forEach(key => this[key] = config[key]);
10+
constructor(config?: {[s: string]: any}) {
11+
if (config) Object.keys(config).forEach(key => this[key] = config[key]);
1212
}
1313

1414
/**

0 commit comments

Comments
 (0)