Tsonic GitHub

Globals (global functions)

Some JS global functions are available as exports from @tsonic/js/index.js.

Example:

import { console, parseInt, parseFloat, encodeURIComponent } from "@tsonic/js/index.js";

export function main(): void {
  console.log(parseInt("42"));
  console.log(parseFloat("3.14"));
  console.log(encodeURIComponent("a b"));
}

API Reference

Globals

export declare const Globals: {
  readonly undefined: unknown | undefined;
  readonly infinity: double;
  readonly naN: double;
  boolean(value: unknown): boolean;
  decodeURI(uri: string): string;
  decodeURIComponent(component: string): string;
  encodeURI(uri: string): string;
  encodeURIComponent(component: string): string;
  isFinite(value: double): boolean;
  isNaN(value: double): boolean;
  number(value: unknown): double;
  parseFloat(str: string): double;
  parseInt(str: string, radix?: Nullable<System_Internal.Int32>): Nullable<System_Internal.Int64>;
  string(value: unknown): string;
};

Global functions

export declare function boolean(value: unknown): boolean;
export declare function decodeURI(uri: string): string;
export declare function decodeURIComponent(component: string): string;
export declare function encodeURI(uri: string): string;
export declare function encodeURIComponent(component: string): string;
export declare function isFinite(value: double): boolean;
export declare function isNaN(value: double): boolean;
export declare function number(value: unknown): double;
export declare function parseFloat(str: string): double;
export declare function parseInt(str: string, radix?: Nullable<System_Internal.Int32>): Nullable<System_Internal.Int64>;
export declare function string(value: unknown): string;