Skip to content

Commit

Permalink
Fixed TypeScript forcing to pass a config to createNewLogger()
Browse files Browse the repository at this point in the history
1. Fixed TypeScript forcing to pass all the values in ConfigImpl
  • Loading branch information
Vasanth Developer committed Oct 12, 2019
1 parent 2d15c88 commit 8b89820
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

// The skeleton which has all possible settings passable to the loggerClass
export interface ConfigImpl {
colored: boolean;
boldType: boolean;
typeCase: typeCase;
theme: string;
verboseIdentifier: Array<string>;
timeFormat: string;
colored?: boolean;
boldType?: boolean;
typeCase?: typeCase;
theme?: string;
verboseIdentifier?: Array<string>;
timeFormat?: string;
}

// typeCase enumerator will hold the int values for type string case
Expand Down
2 changes: 1 addition & 1 deletion lib/itivrutaha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const defaultConfig: ConfigImpl = {
}

// createNewLogger() will create a new instance of the logger class
function createNewLogger(loggerConfig: ConfigImpl): LoggerClass {
function createNewLogger(loggerConfig?: ConfigImpl): LoggerClass {
// Check if any config was passed, if not just return with default config
if (loggerConfig) {
// Loop through all possible config keys, fill the defaults to keys
Expand Down
12 changes: 6 additions & 6 deletions src/config.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export interface ConfigImpl {
colored: boolean;
boldType: boolean;
typeCase: typeCase;
theme: string;
verboseIdentifier: Array<string>;
timeFormat: string;
colored?: boolean;
boldType?: boolean;
typeCase?: typeCase;
theme?: string;
verboseIdentifier?: Array<string>;
timeFormat?: string;
}
export declare enum typeCase {
'upper' = 0,
Expand Down
2 changes: 1 addition & 1 deletion src/config.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/itivrutaha.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ConfigImpl } from './config';
import { LoggerClass } from './loggerClass';
declare function createNewLogger(loggerConfig: ConfigImpl): LoggerClass;
declare function createNewLogger(loggerConfig?: ConfigImpl): LoggerClass;
declare function addCustomType(logString: string, classToAdd: LoggerClass): void;
declare const _default: {
createNewLogger: typeof createNewLogger;
Expand Down
2 changes: 1 addition & 1 deletion src/itivrutaha.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/itivrutaha.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8b89820

Please sign in to comment.