import type { Any, Uint, Int, ErrorNewArg } from './defs'; declare global { namespace NodeJS { interface RequireResolve { (id: string, options?: { paths?: string[]; }): string; paths(request: string): string[] | null; } interface Require { (id: string): any; resolve: RequireResolve; main: Module | undefined; } interface Module { id: string; exports: any; filename: string; loaded: boolean; children: Module[]; paths: string[]; parent: Module | null | undefined; package?: any; require(id: string): any; } } namespace qk { interface Require extends NodeJS.Require { } interface Module extends NodeJS.Module { } } var __binding__: (id: string) => any; var __filename: string; var __dirname: string; var require: qk.Require; var module: qk.Module; var exports: any; /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number * @type number:Number * @global */ /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean * @type boolean:Boolean * @global */ /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object * @type object:Object * @global */ /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String * @type string:String * @global */ /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number * @interface NumberConstructor * @global */ interface NumberConstructor { mix32(x: Uint): Uint; mix32Fast(x: Uint): Uint; mix32Fastest(x: Uint): Uint; } /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object * @interface ObjectConstructor * @global */ interface ObjectConstructor { hashCode(obj: any): Int; } /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object * @interface Object * @global */ interface Object { hashCode(): Int; } /** * @interface Dict Dictionaries * @global */ interface Dict extends Record { } /** * @interface TimeoutResult * @global */ interface TimeoutResult extends Any { } /** * Console methods provided by the Qk JavaScript runtime. * @interface Console * @global */ interface Console { log(...data: any[]): void; warn(...data: any[]): void; error(...data: any[]): void; clear(): void; debug(...data: any[]): void; info(...data: any[]): void; dir(item?: any, options?: any): void; dirxml(...data: any[]): void; table(tabularData?: any, properties?: string[]): void; trace(...data: any[]): void; group(...data: any[]): void; groupCollapsed(...data: any[]): void; groupEnd(): void; count(label?: string): void; time(label?: string): void; timeEnd(label?: string): void; assert(condition?: boolean, ...data: any[]): void; } var console: Console; /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function * @interface Function * @global */ interface Function { hashCode(): Int; setTimeout(this: Function, time: Uint, ...argArray: any[]): TimeoutResult; } interface CallableFunction extends Function { setTimeout(this: (...args: A) => R, time: Uint, ...args: A): TimeoutResult; } /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array * @interface Array * @global */ interface Array { hashCode(): Int; deleteOf(value: T): boolean; reverseAt(at: Uint): T; indexAt(at: Uint): T; } /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array * @interface ArrayConstructor * @global */ interface ArrayConstructor { toArray(obj: any, from?: Uint, end?: Uint): any[]; } /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String * @interface String * @global */ interface String { hashCode(): Int; } /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String * @interface StringConstructor * @global */ interface StringConstructor { format(str: string, ...args: any[]): string; } /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number * @interface Number * @global */ interface Number { hashCode(): Int; /** * Convert to a string with a fixed number of digits before and after the decimal point * * @param before Fixed number of digits before the decimal point * @param after? Fixed number of digits after the decimal point */ toFixedBefore(before: Uint, after?: Uint): string; /** * Fixed the number of digits before the decimal point and used symbol separation * * @param after Fixed number of digits before the decimal point * @param split? Split unit length * @param symbol? Split characters * * @example * * ```ts * // Print: 1,000,000.03 * console.log((1000000.03).toFixedVariable(8,3,',')) * ``` */ toFixedVariable(after: Uint, split?: Uint, symbol?: string): string; } /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean * @interface Boolean * @global */ interface Boolean { hashCode(): Int; } /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date * @interface DateConstructor * @global */ interface DateConstructor { /** * current timezone * @static */ currentTimezone: Uint; /** * Parse a string as a time * @param str The string to parse * @param format? date format default yyyyMMddhhmmssfff * @param timezone? The time zone of the time to be parsed, the default is the current time zone * @return Retruu Date object * @static * * @example * * ```ts * let i = '2008-02-13 01:12:13'; * let date = Date.parseDate(i); // The new time returned * ``` */ parseDate(date_str: string, format?: string, timezone?: Uint): Date; /** * Formatting timestamps * * @method formatTimeSpan(ts,format?) * @param time_span The timestamp to format * @param format? The timestamp format to be formatted * @return The returned formatted timestamp * @static * * @example * * ```ts * // Format timestamp (unit: milliseconds) * let time_span = 10002100; * let format = 'dd hh:mm:ss'; * let str = Date.formatTimeSpan(time_span, format); // str = '0 2:46:42' * let format = 'dd天hh时mm分ss秒'; * let str = Date.formatTimeSpan(time_span, format); // str = '0天2时46分42秒' * format = 'hh时mm分ss秒'; * str = Date.formatTimeSpan(time_span, format); // str = '2时46分42秒' * format = 'mm分ss秒'; * str = Date.formatTimeSpan(time_span, format); // str = '166分42秒' * ``` */ formatTimeSpan(time_span: Uint, format?: string): string; } /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date * @interface Date * @global */ interface Date { hashCode(): Int; /** * Add milliseconds to the current Date time and change the time value * @param ms The millisecond value to append */ addMilliseconds(ms: Uint): this; /** * Returns a date string given a date format * @param format? The format of the string to be converted * @return Returns the formatted time string * * @exmples * * ```ts * let date = new Date(); * let format = 'yyyy-MM-dd hh:mm:ss.fff'; * let dateStr = date.toString(format); // dateStr的值为 '2008-12-10 10:32:23' * format = 'yyyy-MM-dd hh:mm:ss'; * dateStr = date.toString(format); // dateStr的值为 '2008-12-10 10:32:23' * format = 'yyyy/MM/dd'; * dateStr = date.toString(format); // dateStr的值为 '2008/12/10' * format = 'yyyy-MM-dd hh'; * dateStr = date.toString(format); // dateStr的值为 '2008-12-10 10' * ``` */ toString(format?: string, timezone?: number): string; } /** * @interface ErrorDescribe * @global */ interface ErrorDescribe extends Dict { name?: string; message?: string; error?: string; description?: string; errno?: number | string; child?: Error | Error[]; } /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error * @interface ErrorConstructor * @global */ interface ErrorConstructor { 'new'(err: ErrorNewArg, ...child: ErrorNewArg[]): Error; toJSON(err: Error): any; setStackTraceJSON(enable: boolean): void; /** * Create .stack property on a target object * @static */ captureStackTrace(targetObject: Object, constructorOpt?: Function): void; } /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error * @interface Error * @global */ interface Error extends Dict { errno?: number | string; description?: string; child?: Error[]; set: (desc: ErrorDescribe) => this; } function setTimeout(cb: (...args: A) => void, timeout?: number, ...args: A): TimeoutResult; function setInterval(cb: (...args: A) => void, timeout?: number, ...args: A): TimeoutResult; function setImmediate(cb: (...args: A) => void, ...args: A): TimeoutResult; function queueMicrotask(callback: () => void): void; function clearTimeout(id?: TimeoutResult): void; function clearInterval(id?: TimeoutResult): void; function clearImmediate(id?: TimeoutResult): void; }