diff --git a/README.md b/README.md index 92371d3..549585e 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ $ npm install --save csharp-models-to-typescript 1. Add a config file to your project that contains for example... -``` +```json { "include": [ "./models/**/*.cs", @@ -44,7 +44,8 @@ $ npm install --save csharp-models-to-typescript "customTypeTranslations": { "ProductName": "string", "ProductNumber": "string" - } + }, + "exportedModule": false } ``` diff --git a/converter.js b/converter.js index ca44af0..63c6e7f 100644 --- a/converter.js +++ b/converter.js @@ -47,7 +47,7 @@ const createConverter = config => { if (config.namespace) { return [ - `declare module ${config.namespace} {`, + `${config.exportedModule ? 'export' : 'declare'} module ${config.namespace} {`, ...filteredContent, '}', ].join('\n'); diff --git a/index.js b/index.js index 934ed05..8dfe7ca 100755 --- a/index.js +++ b/index.js @@ -37,7 +37,8 @@ const converter = createConverter({ camelCaseOptions: config.camelCaseOptions || {}, camelCaseEnums: config.camelCaseEnums || false, numericEnums: config.numericEnums || false, - stringLiteralTypesInsteadOfEnums: config.stringLiteralTypesInsteadOfEnums || false + stringLiteralTypesInsteadOfEnums: config.stringLiteralTypesInsteadOfEnums || false, + exportedModule: config.exportedModule || false }); let timer = process.hrtime();