Skip to content

Commit 88b1e3c

Browse files
committed
feat: add TypeScript typings
1 parent a1c1ea6 commit 88b1e3c

4 files changed

Lines changed: 26 additions & 0 deletions

File tree

index.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
declare function _exports(reload?: boolean): import("config").IConfig;
2+
declare namespace _exports {
3+
export { reloadConfigs };
4+
}
5+
export = _exports;
6+
declare function reloadConfigs(): import("config").IConfig;

index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
'use strict';
22

3+
/**
4+
* @return {import("config").IConfig}
5+
*/
36
function reloadConfigs () {
47
const config = require('config');
58
const sources = config.util.getConfigSources();
@@ -15,6 +18,10 @@ function reloadConfigs () {
1518
return require('config');
1619
}
1720

21+
/**
22+
* @param {boolean} [reload=false] Whether to reload the configuration
23+
* @return {import("config").IConfig}
24+
*/
1825
module.exports = function (reload) {
1926
return reload ? reloadConfigs() : require('config');
2027
};

package-lock.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.0.10",
44
"description": "Reloadable version of config",
55
"main": "index.js",
6+
"types": "index.d.ts",
67
"scripts": {
78
"test": "nyc --reporter=clover --reporter=text mocha test/"
89
},
@@ -25,13 +26,18 @@
2526
},
2627
"homepage": "https://github.com/sjinks/node-config-reloadable#readme",
2728
"devDependencies": {
29+
"@types/config": "^3.3.3",
2830
"config": "^3.3.9",
2931
"mocha": "^10.2.0",
3032
"nyc": "^15.1.0"
3133
},
3234
"peerDependencies": {
3335
"config": "*"
3436
},
37+
"files": [
38+
"index.js",
39+
"index.d.ts"
40+
],
3541
"publishConfig": {
3642
"provenance": true
3743
}

0 commit comments

Comments
 (0)