Skip to main content
Version: 3.6

nasl.core

type BooleanAlias = Boolean;
type StringAlias = String;

declare namespace nasl.core {
export type Any = any;

export type Boolean = BooleanAlias;

// Integer<Long<Double 小类型可以隐式转换为大类型,反之不可。
export class Integer {
accept: 'Integer';
constructor(num?: number);
}

export class Double {
accept: 'Double' | 'Integer' | 'Long';
constructor(num?: number);
}

export class Long {
accept: 'Double' | 'Integer';
constructor(num?: number);
}

export type String = StringAlias;

export class Text extends String {
}

export class Binary {
accept: 'Binary';
}

export class Date {
accept: 'Date';
}

export class Time {
accept: 'Time';
}

export class DateTime {
accept: 'DateTime';
}

export class Email extends String {
subAccept: 'Email';
}
// &&
export function and(left: Boolean, right: Boolean): Boolean;
// ||
export function or(left: Boolean, right: Boolean): Boolean;

export function add(left: Integer, right: Integer): Integer;
export function add(left: Long, right: Long): Long;
export function add(left: Double, right: Double): Double;
export function add(left: Integer, right: Long): Long;
export function add(left: Long, right: Integer): Long;
export function add(left: Integer, right: Double): Double;
export function add(left: Double, right: Integer): Double;
export function add(left: Long, right: Double): Double;
export function add(left: Double, right: Long): Double;
export function add(left: String, right: Any): String;
export function add(left: Any, right: String): String;
export function add(left: Integer, right: Integer): Integer; // 为了让提示到整数上,最后补一个重载

export function minus(left: Integer, right: Integer): Integer;
export function minus(left: Long, right: Long): Long;
export function minus(left: Double, right: Double): Double;
export function minus(left: Integer, right: Long): Long;
export function minus(left: Long, right: Integer): Long;
export function minus(left: Integer, right: Double): Double;
export function minus(left: Double, right: Integer): Double;
export function minus(left: Long, right: Double): Double;
export function minus(left: Double, right: Long): Double;
export function minus(left: Integer, right: Integer): Integer;

export function multiply(left: Integer, right: Integer): Integer;
export function multiply(left: Long, right: Long): Long;
export function multiply(left: Double, right: Double): Double;
export function multiply(left: Integer, right: Long): Long;
export function multiply(left: Long, right: Integer): Long;
export function multiply(left: Integer, right: Double): Double;
export function multiply(left: Double, right: Integer): Double;
export function multiply(left: Long, right: Double): Double;
export function multiply(left: Double, right: Long): Double;
export function multiply(left: Integer, right: Integer): Integer;

export function divide(left: Integer, right: Integer): Integer;
export function divide(left: Long, right: Long): Long;
export function divide(left: Double, right: Double): Double;
export function divide(left: Integer, right: Long): Long;
export function divide(left: Long, right: Integer): Long;
export function divide(left: Integer, right: Double): Double;
export function divide(left: Double, right: Integer): Double;
export function divide(left: Long, right: Double): Double;
export function divide(left: Double, right: Long): Double;
export function divide(left: Integer, right: Integer): Integer;

export function remainder(left: Integer, right: Integer): Integer;
export function remainder(left: Long, right: Long): Long;
export function remainder(left: Double, right: Double): Double;
export function remainder(left: Integer, right: Long): Long;
export function remainder(left: Long, right: Integer): Long;
export function remainder(left: Integer, right: Double): Double;
export function remainder(left: Double, right: Integer): Double;
export function remainder(left: Long, right: Double): Double;
export function remainder(left: Double, right: Long): Double;
export function remainder(left: Integer, right: Integer): Integer;

export function ensureBoolean(value: Boolean): Boolean;

export let universalVariable: nasl.core.Any;

export class Enums {
accept: 'Enums';
}
}