@anjianshi/utils 2.8.4 → 2.9.0

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.
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * 生成一个 state 以及与其值同步的 ref
3
3
  */
4
- export declare function useStateWithRef<T>(initialValue: T | (() => T)): readonly [T, (value: T | ((prevState: T) => T)) => void, import("react").RefObject<T>];
4
+ export declare function useStateWithRef<T>(initialValue: T | (() => T)): readonly [T, import("react").Dispatch<import("react").SetStateAction<T>>, import("react").RefObject<T>];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anjianshi/utils",
3
- "version": "2.8.4",
3
+ "version": "2.9.0",
4
4
  "description": "Common JavaScript Utils",
5
5
  "homepage": "https://github.com/anjianshi/js-packages/utils",
6
6
  "bugs": {
@@ -33,10 +33,10 @@
33
33
  "vconsole": "^3.15.1",
34
34
  "@anjianshi/presets-eslint-base": "6.0.0",
35
35
  "@anjianshi/presets-eslint-react": "6.0.0",
36
- "@anjianshi/presets-eslint-node": "6.0.0",
37
- "@anjianshi/presets-eslint-typescript": "6.0.0",
38
36
  "@anjianshi/presets-prettier": "3.0.4",
39
- "@anjianshi/presets-typescript": "3.2.4"
37
+ "@anjianshi/presets-typescript": "3.2.4",
38
+ "@anjianshi/presets-eslint-typescript": "6.0.0",
39
+ "@anjianshi/presets-eslint-node": "6.0.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@emotion/react": "^11.14.0",
@@ -4,9 +4,9 @@
4
4
  import { Dayjs } from 'dayjs';
5
5
  import { type CommonOptions } from './base.js';
6
6
  export interface DatetimeOptions extends CommonOptions<number> {
7
- raw?: boolean;
7
+ dayjs?: boolean;
8
8
  }
9
9
  export type DatetimeValue<Options extends DatetimeOptions> = Options extends {
10
- raw: true;
11
- } ? Date : Dayjs;
10
+ dayjs: true;
11
+ } ? Dayjs : Date;
12
12
  export declare function getDatetimeValidator<const Options extends DatetimeOptions>(options?: Options): import("./base.js").Validator<DatetimeValue<Options>, Options>;
@@ -25,6 +25,6 @@ export function getDatetimeValidator(options = {}) {
25
25
  else {
26
26
  return failed(`${field} must be a datetime string or unix timestamp`);
27
27
  }
28
- return success((options.raw ? dayjsValue.toDate() : dayjsValue));
28
+ return success((options.dayjs ? dayjsValue : dayjsValue.toDate()));
29
29
  })(options);
30
30
  }