@anjianshi/utils 2.3.10 → 2.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,7 +35,7 @@ export declare class EnvReader {
35
35
  * 同 envReader.get(),只不过是通过对象指定各 env 的默认值来批量获取
36
36
  * envReader.batchGet({ port: 8000, debug: false, mobiles: ['123', '456'] }
37
37
  */
38
- batchGet<Defs extends Record<string, EnvValue>>(definitions: Defs): Defs;
38
+ batchGet<Defs extends Record<string, EnvValue>>(definitions: Defs): { [K in keyof Defs]: Defs[K] extends string ? string : Defs[K] extends number ? number : Defs[K] extends boolean ? boolean : Defs[K]; };
39
39
  /**
40
40
  * 同 envReader.getByType(),只不过是通过对象指定各 env 的类型来批量获取。
41
41
  *
@@ -62,6 +62,7 @@ export class EnvReader {
62
62
  for (const [key, defaults] of Object.entries(definitions)) {
63
63
  result[key] = this.get(key, defaults);
64
64
  }
65
+ // 保证返回的值类型是“通用化”的,例如不是 `false` 而是 `boolean`
65
66
  return result;
66
67
  }
67
68
  batchGetByType(definitions, required = false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anjianshi/utils",
3
- "version": "2.3.10",
3
+ "version": "2.3.11",
4
4
  "description": "Common JavaScript Utils",
5
5
  "homepage": "https://github.com/anjianshi/js-packages/utils",
6
6
  "bugs": {
@@ -28,9 +28,9 @@
28
28
  "vconsole": "^3.15.1",
29
29
  "@anjianshi/presets-eslint-node": "4.0.8",
30
30
  "@anjianshi/presets-eslint-typescript": "5.0.5",
31
- "@anjianshi/presets-typescript": "3.2.2",
32
31
  "@anjianshi/presets-prettier": "3.0.1",
33
- "@anjianshi/presets-eslint-react": "4.0.7"
32
+ "@anjianshi/presets-eslint-react": "4.0.7",
33
+ "@anjianshi/presets-typescript": "3.2.2"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@emotion/react": "^11.13.3",