From 4c5cfd49fa375c72668b93b0a60449011357f548 Mon Sep 17 00:00:00 2001 From: iapyang Date: Wed, 4 Sep 2019 19:52:23 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=8E=BB=E6=8E=89declear?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typescript/core/func/array.ts | 6 +++--- typescript/core/func/date.ts | 34 ++++++++++++++++---------------- typescript/core/func/function.ts | 8 ++++---- typescript/core/func/number.ts | 8 ++++---- typescript/core/func/string.ts | 14 ++++++------- typescript/core/i18n.ts | 6 +++--- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/typescript/core/func/array.ts b/typescript/core/func/array.ts index a2e963a323..e33481f9fc 100644 --- a/typescript/core/func/array.ts +++ b/typescript/core/func/array.ts @@ -1,8 +1,8 @@ -export declare type _pushArray = (sArray: any[], array: any[]) => void; +export type _pushArray = (sArray: any[], array: any[]) => void; -export declare type _pushDistinct = (sArray: any[], obj: any) => void; +export type _pushDistinct = (sArray: any[], obj: any) => void; -export declare type _pushDistinctArray = (sArray: any[], array: any[]) => void; +export type _pushDistinctArray = (sArray: any[], array: any[]) => void; declare type _array = { pushArray: _pushArray; diff --git a/typescript/core/func/date.ts b/typescript/core/func/date.ts index 30e1a50814..6cc1e0f653 100644 --- a/typescript/core/func/date.ts +++ b/typescript/core/func/date.ts @@ -1,4 +1,4 @@ -export declare type _Date = { +export type _Date = { SECOND: number; MINUTE: number; HOUR: number; @@ -16,79 +16,79 @@ export declare type _Date = { /** * 获取时区 */ -export declare type _getTimezone = (date: Date) => string; +export type _getTimezone = (date: Date) => string; /** * 获取指定月共有多少天 */ -export declare type _getMonthDays = (date: Date, month: number) => string; +export type _getMonthDays = (date: Date, month: number) => string; /** * 获取指定月的最后一天 */ -export declare type _getLastDateOfMonth = (data: Date) => Date; +export type _getLastDateOfMonth = (data: Date) => Date; /** * 获取指定时间距离当年已经过了多少天 */ -export declare type _getDayOfYear = (data: Date) => number; +export type _getDayOfYear = (data: Date) => number; /** * 获取指定时间距离当年已经过了多少周 */ -export declare type _getWeekNumber = (data: Date) => number; +export type _getWeekNumber = (data: Date) => number; /** * 获取指定时间的所处季度 */ -export declare type _getQuarter = (date: Date) => number; +export type _getQuarter = (date: Date) => number; /** * 离当前时间多少天的时间 */ -export declare type _getOffsetDate = (date: Date, offset: number) => Date; +export type _getOffsetDate = (date: Date, offset: number) => Date; /** * 离当前时间多少天季度的时间 */ -export declare type _getOffsetQuarter = (date: Date, n: number) => Date; +export type _getOffsetQuarter = (date: Date, n: number) => Date; /** * 得到本季度的起始月份 */ -export declare type _getQuarterStartMonth = (date: Date) => number; +export type _getQuarterStartMonth = (date: Date) => number; /** * 获得本季度的起始日期 */ -export declare type _getQuarterStartDate = (date: Date) => number; +export type _getQuarterStartDate = (date: Date) => number; /** * 获取本季度的其实日期 */ -export declare type _getQuarterEndDate = (date: Date) => number; +export type _getQuarterEndDate = (date: Date) => number; /** * 指定日期n个月之前或之后的日期 */ -export declare type _getOffsetMonth = (date: Date, n: number) => Date; +export type _getOffsetMonth = (date: Date, n: number) => Date; /** * 获取本周的起始日期 */ -export declare type _getWeekStartDate = (date: Date) => Date; +export type _getWeekStartDate = (date: Date) => Date; /** * 获取本周的结束日期 */ -export declare type _getWeekEndDate = (date: Date) => Date; +export type _getWeekEndDate = (date: Date) => Date; /** * 格式化打印日期 */ -export declare type _print = (date: Date, str: string) => string; +export type _print = (date: Date, str: string) => string; -export declare type _date = { +export type _date = { getTimezone: _getTimezone; getMonthDays: _getMonthDays; getLastDateOfMonth: _getLastDateOfMonth; diff --git a/typescript/core/func/function.ts b/typescript/core/func/function.ts index 8aed27b427..f118d19e11 100644 --- a/typescript/core/func/function.ts +++ b/typescript/core/func/function.ts @@ -4,7 +4,7 @@ * @param name 待生成的名字 * @return 生成后的名字 */ -export declare type _createDistinctName = (array: any[], name: string) => string; +export type _createDistinctName = (array: any[], name: string) => string; /** * 获取搜索结果 @@ -12,21 +12,21 @@ export declare type _createDistinctName = (array: any[], name: string) => string * @param keyword 关键字 * @param param 搜索哪个属性 */ -export declare type _getSearchResult = (items: any, keyword: any, param: string) => {find: any, match: any} +export type _getSearchResult = (items: any, keyword: any, param: string) => {find: any, match: any} /** * 在方法A执行之前执行方法B * @param sFunc 方法A * @param func 方法B */ -export declare type _beforeFunc = (sFunc: Function, func: Function) => Function; +export type _beforeFunc = (sFunc: Function, func: Function) => Function; /** * 在方法A执行之后执行方法B * @param sFunc 方法A * @param func 方法B */ -export declare type _afterFunc = (sFunc: Function, func: Function) => Function; +export type _afterFunc = (sFunc: Function, func: Function) => Function; declare type _function = { createDistinctName: _createDistinctName; diff --git a/typescript/core/func/number.ts b/typescript/core/func/number.ts index 185f29861c..7b99e5575c 100644 --- a/typescript/core/func/number.ts +++ b/typescript/core/func/number.ts @@ -5,7 +5,7 @@ * @param {Number} arg 加数 * @return {Number} 两个数字相加后的结果 */ -export declare type _add = (num: number, arg: number) => number; +export type _add = (num: number, arg: number) => number; /** * 减法函数,用来得到精确的减法结果 @@ -13,7 +13,7 @@ export declare type _add = (num: number, arg: number) => number; * @param {Number} arg 减数 * @return {Number} 两个数字相减后的结果 */ -export declare type _sub = (num: number, arg: number) => number; +export type _sub = (num: number, arg: number) => number; /** * 乘法函数,用来得到精确的乘法结果 @@ -21,7 +21,7 @@ export declare type _sub = (num: number, arg: number) => number; * @param {Number} arg 乘数 * @return {Number} 两个数字相乘后的结果 */ -export declare type _mul = (num: number, arg: number) => number; +export type _mul = (num: number, arg: number) => number; /** * 除法函数,用来得到精确的除法结果 @@ -29,7 +29,7 @@ export declare type _mul = (num: number, arg: number) => number; * @param {Number} arg 除数 * @return {Number} 两个数字相除后的结果 */ -export declare type _div = (num: number, arg: number) => number; +export type _div = (num: number, arg: number) => number; declare type _number = { add: _add; diff --git a/typescript/core/func/string.ts b/typescript/core/func/string.ts index 2e2c5e1aa8..9be899ccd0 100644 --- a/typescript/core/func/string.ts +++ b/typescript/core/func/string.ts @@ -4,7 +4,7 @@ * @param {String} startTag 指定的开始字符串 * @return {Boolean} 如果字符串以指定字符串开始则返回true,否则返回false */ -export declare type _startWith = (str: string, startTag: string) => boolean; +export type _startWith = (str: string, startTag: string) => boolean; /** * 判断字符串是否以指定的字符串结束 @@ -12,7 +12,7 @@ export declare type _startWith = (str: string, startTag: string) => boolean; * @param {String} endTag 指定的字符串 * @return {Boolean} 如果字符串以指定字符串结束则返回true,否则返回false */ -export declare type _endWith = (str: string, endTag: string) => boolean; +export type _endWith = (str: string, endTag: string) => boolean; /** * 获取url中指定名字的参数 @@ -20,7 +20,7 @@ export declare type _endWith = (str: string, endTag: string) => boolean; * @param {String} name 参数的名字 * @return {String} 参数的值 */ -export declare type _getQuery = (str: string, name: string) => string|null; +export type _getQuery = (str: string, name: string) => string|null; /** * 给url加上给定的参数 @@ -28,7 +28,7 @@ export declare type _getQuery = (str: string, name: string) => string|null; * @param {Object} paras 参数对象,是一个键值对对象 * @return {String} 添加了给定参数的url */ -export declare type _appendQuery = (str: string, paras: {[key: string]: string|number}) => string; +export type _appendQuery = (str: string, paras: {[key: string]: string|number}) => string; /** * 将所有符合第一个字符串所表示的字符串替换成为第二个字符串 @@ -37,7 +37,7 @@ export declare type _appendQuery = (str: string, paras: {[key: string]: string|n * @param {String} s2 替换的结果字符串 * @returns {String} 替换后的字符串 */ -export declare type _replaceAll = (str: string, s1: string, s2: string) => string; +export type _replaceAll = (str: string, s1: string, s2: string) => string; /** * 总是让字符串以指定的字符开头 @@ -45,7 +45,7 @@ export declare type _replaceAll = (str: string, s1: string, s2: string) => strin * @param {String} start 指定的字符 * @returns {String} 以指定字符开头的字符串 */ -export declare type _perfectStart = (str: string, start: string) => string; +export type _perfectStart = (str: string, start: string) => string; /** * 获取字符串中某字符串的所有项位置数组 @@ -53,7 +53,7 @@ export declare type _perfectStart = (str: string, start: string) => string; * @param {String} sub 子字符串 * @return {Number[]} 子字符串在父字符串中出现的所有位置组成的数组 */ -export declare type _allIndexOf = (str: string, sub: string) => number[]; +export type _allIndexOf = (str: string, sub: string) => number[]; declare type _string = { startWith: _startWith; diff --git a/typescript/core/i18n.ts b/typescript/core/i18n.ts index 95aa195846..79903578a3 100644 --- a/typescript/core/i18n.ts +++ b/typescript/core/i18n.ts @@ -1,8 +1,8 @@ -export declare type _addI18n = (v: string | object) => string; +export type _addI18n = (v: string | object) => string; -export declare type _i18nText = (key: string, ..._args: any[]) => string; +export type _i18nText = (key: string, ..._args: any[]) => string; -export declare type _i18n = { +export type _i18n = { addI18n: _addI18n; i18nText: _i18nText; } \ No newline at end of file