Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
210 changes: 105 additions & 105 deletions types/titanium/console.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,111 +3,111 @@
* and modified for Titanium
*/

declare module "console" {
global {
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
/**
* Console logging facilities.
*/
interface Console {
/**
* A simple assertion test that verifies whether value is truthy. If it is not, Assertion failed is logged. If provided, the error message is formatted using `util.format()` by passing along all message arguments. The output is used as the error message.
*/
assert(value?: any, ...message: any[]): void;

/**
* Maintains an internal counter specific to `label` and outputs to stdout the number of times `console.count()` has been called with the given `label`.
*/
count(label?: string): void;

/**
* Resets the internal counter specific to `label`.
*/
countReset(label?: string): void;

/**
* Log a message at the `debug` level.
*/
debug(...message: any[]): void;

/**
* Log a message at the `error` level.
*/
error(...message: any[]): void;

/**
* Increases indentation of subsequent lines by spaces for `groupIndentation` length.
*/
group(...label: any[]): void;

/**
* Alias for `group()`
*/
groupCollapsed(...label: any[]): void;

/**
* Decreases indentation of subsequent lines by spaces for `groupIndentation` length.
*/
groupEnd(): void;

/**
* Log a message at the `info` level.
*/
info(...message: any[]): void;

/**
* Log a message at the `info` level.
*/
log(...message: any[]): void;

/**
* Start a timer to track duration of an operation.
*/
time(label?: string): void;

/**
* Stop a timer that was previously started.
*/
timeEnd(label?: string): void;

/**
* Log duration taken so far for an operation.
*/
timeLog(label?: string, ...data: any[]): void;

/**
* Log a message at the `trace` level.
*/
trace(...message: any[]): void;

/**
* Log a message at the `warn` level.
*/
warn(...message: any[]): void;
declare module 'console' {
global {
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
/**
* Console logging facilities.
*/
interface Console {
/**
* A simple assertion test that verifies whether value is truthy. If it is not, Assertion failed is logged. If provided, the error message is formatted using `util.format()` by passing along all message arguments. The output is used as the error message.
*/
assert(value?: any, ...message: any[]): void;

/**
* Maintains an internal counter specific to `label` and outputs to stdout the number of times `console.count()` has been called with the given `label`.
*/
count(label?: string): void;

/**
* Resets the internal counter specific to `label`.
*/
countReset(label?: string): void;

/**
* Log a message at the `debug` level.
*/
debug(...message: any[]): void;

/**
* Log a message at the `error` level.
*/
error(...message: any[]): void;

/**
* Increases indentation of subsequent lines by spaces for `groupIndentation` length.
*/
group(...label: any[]): void;

/**
* Alias for `group()`
*/
groupCollapsed(...label: any[]): void;

/**
* Decreases indentation of subsequent lines by spaces for `groupIndentation` length.
*/
groupEnd(): void;

/**
* Log a message at the `info` level.
*/
info(...message: any[]): void;

/**
* Log a message at the `info` level.
*/
log(...message: any[]): void;

/**
* Start a timer to track duration of an operation.
*/
time(label?: string): void;

/**
* Stop a timer that was previously started.
*/
timeEnd(label?: string): void;

/**
* Log duration taken so far for an operation.
*/
timeLog(label?: string, ...data: any[]): void;

/**
* Log a message at the `trace` level.
*/
trace(...message: any[]): void;

/**
* Log a message at the `warn` level.
*/
warn(...message: any[]): void;
}

var console: Console;

namespace Titanium {
interface ConsoleConstructorOptions {
stdout: object;
stderr?: object | undefined;
ignoreErrors?: boolean | undefined;
colorMode?: boolean | 'auto' | undefined;
inspectOptions?: object | undefined;
}

interface ConsoleConstructor {
prototype: Console;
new(stdout: object, stderr?: object, ignoreErrors?: boolean): Console;
new(options: ConsoleConstructorOptions): Console;
}

interface Global {
console: typeof console;
}
}
}

var console: Console;

namespace Titanium {
interface ConsoleConstructorOptions {
stdout: object;
stderr?: object | undefined;
ignoreErrors?: boolean | undefined;
colorMode?: boolean | 'auto' | undefined;
inspectOptions?: object | undefined;
}

interface ConsoleConstructor {
prototype: Console;
new(stdout: object, stderr?: object, ignoreErrors?: boolean): Console;
new(options: ConsoleConstructorOptions): Console;
}

interface Global {
console: typeof console;
}
}
}

export = console;
export = console;
}
114 changes: 57 additions & 57 deletions types/titanium/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,64 +106,64 @@ declare function setTimeout(func: (...args: any[]) => void, delay?: number): num
// String constructor augmentation ---------------------------------------------

interface StringConstructor {
/**
* Formats a string using `printf`-style substitution.
*
* @param formatString An IEEE `printf`-style string, containing zero or more conversion specifications.
* @param value Values to substitute into the `formatString`.
*/
format(formatString: string, ...value: Array<string | number>): string;

/**
* Formats a number into the currency format, including currency symbol, of the locale
* configured for the system.
*
* @param value Currency value,
*/
formatCurrency(value: number): string;

/**
* Formats a date into the date format of the locale configured for the system.
*
* @param date Date to format.
* @param format Date format to use. One of 'short', 'medium', 'long' or 'full'. Defaults to 'short'.
*/
formatDate(date: Date, format?: string): string;

/**
* Formats a number into the decimal format, including decimal symbol, of the locale
* configured for the system.
*
* @param value Value to format.
* @param pattern Format pattern.
*/
formatDecimal(value: number, pattern: string): string;
/**
* @param value Value to format.
* @param locale Locale string. For example, `en-US` for US English.
* @param pattern Format pattern.
*/
formatDecimal(value: number, locale: string, pattern: string): string;

/**
* Formats a date into the time format of the locale configured for the system.
*
* @param date Date to format.
* @param format Date format to use. One of 'short', 'medium', or 'long' (iOS only). Defaults to 'short'.
*/
formatTime(date: Date, format?: string): string;
/**
* Formats a string using `printf`-style substitution.
*
* @param formatString An IEEE `printf`-style string, containing zero or more conversion specifications.
* @param value Values to substitute into the `formatString`.
*/
format(formatString: string, ...value: Array<string | number>): string;

/**
* Formats a number into the currency format, including currency symbol, of the locale
* configured for the system.
*
* @param value Currency value,
*/
formatCurrency(value: number): string;

/**
* Formats a date into the date format of the locale configured for the system.
*
* @param date Date to format.
* @param format Date format to use. One of 'short', 'medium', 'long' or 'full'. Defaults to 'short'.
*/
formatDate(date: Date, format?: string): string;

/**
* Formats a number into the decimal format, including decimal symbol, of the locale
* configured for the system.
*
* @param value Value to format.
* @param pattern Format pattern.
*/
formatDecimal(value: number, pattern: string): string;
/**
* @param value Value to format.
* @param locale Locale string. For example, `en-US` for US English.
* @param pattern Format pattern.
*/
formatDecimal(value: number, locale: string, pattern: string): string;

/**
* Formats a date into the time format of the locale configured for the system.
*
* @param date Date to format.
* @param format Date format to use. One of 'short', 'medium', or 'long' (iOS only). Defaults to 'short'.
*/
formatTime(date: Date, format?: string): string;
}

declare namespace Titanium {
interface Global {
L(key: string, hint?: string): string;
alert(message: string): void;
clearInterval(timerId?: number): void;
clearTimeout(timerId?: number): void;
decodeURIComponent(encodedURI: string): string;
encodeURIComponent(string: string): string;
require(moduleId: string): any;
setInterval(func: (...args: any[]) => void, delay?: number): number;
setTimeout(func: (...args: any[]) => void, delay?: number): number;
}
interface Global {
L(key: string, hint?: string): string;
alert(message: string): void;
clearInterval(timerId?: number): void;
clearTimeout(timerId?: number): void;
decodeURIComponent(encodedURI: string): string;
encodeURIComponent(string: string): string;
require(moduleId: string): any;
setInterval(func: (...args: any[]) => void, delay?: number): number;
setTimeout(func: (...args: any[]) => void, delay?: number): number;
}
}
Loading