ソースを参照

🏷️ chore(helper/config/range): 给rangepicker添加类型

晓晓晓晓丶vv 4 年 前
コミット
c5bf8b17a3
2 ファイル変更7 行追加1 行削除
  1. 1 1
      src/helper/config/range.ts
  2. 6 0
      src/types/global.d.ts

+ 1 - 1
src/helper/config/range.ts

@@ -24,7 +24,7 @@ export const pickerText = {
  * @methods add("本周", [moment(), moment()])
  * @methods pick(["today", "week"])
  */
-class RangePicker {
+class RangePicker implements RangePickerClass {
   private config: Record<string, moment.Moment[]>;
 
   constructor() {

+ 6 - 0
src/types/global.d.ts

@@ -14,4 +14,10 @@ declare type SelectOptions<T = any> = {
 
 declare type EmitType = (event: string, ...args: any[]) => void;
 
+declare interface RangePickerClass {
+  add(text: string, range: moment.Moment[]): this;
 
+  pick(range: string[]): this;
+
+  getRange(): Record<string, moment.Moment[]>;
+}