declare namespace nasl.core { export type Any = any; export class Boolean extends globalThis.Boolean { } export class BooleanTrue extends Boolean { _value: true; } export class BooleanFalse extends Boolean { _value: false; } // export type Boolean = BooleanTrue | BooleanFalse; export class StringLiteral extends String { _value: T; } export class NumberLiteral extends nasl.core.Decimal { _value: T; } export class Decimal { accept: 'Decimal' | 'Long'; constructor(num?: number); } export class Long { accept: 'Long'; constructor(num?: number); } export class String extends globalThis.String { // @ts-ignore length: nasl.core.Long; } 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 Union { accept: 'Union'; } export type Primitive = Long | Decimal | String | Boolean | Date | Time | DateTime; // && export function and(left: Boolean, right: Boolean): Boolean; // || export function or(left: Boolean, right: Boolean): Boolean; export function add(left: Long, right: Long): Long; export function add(left: Decimal, right: Decimal): Decimal; export function add(left: String, right: Any): String; export function add(left: Any, right: String): String; export function add(left: Long, right: Long): Long; // 为了让提示到整数上,最后补一个重载 export function minus(left: Long, right: Long): Long; export function minus(left: Decimal, right: Decimal): Decimal; export function minus(left: Long, right: Long): Long; export function multiply(left: Long, right: Long): Long; export function multiply(left: Decimal, right: Decimal): Decimal; export function multiply(left: Long, right: Long): Long; export function divide(left: Long, right: Long): Decimal; export function divide(left: Decimal, right: Decimal): Decimal; export function divide(left: Long, right: Long): Decimal; export function remainder(left: Long, right: Long): Long; export function remainder(left: Decimal, right: Decimal): Decimal; export function remainder(left: Long, right: Long): Long; export function equal(left: T, right: T): Boolean; export function isEqual(left: T, right: T): Boolean; export function notEqual(left: T, right: T): Boolean; export function isNotEqual(left: T, right: T): Boolean; export function greaterThan(left: Long, right: Long): Boolean; export function greaterThan(left: String, right: String): Boolean; export function greaterThan(left: Date, right: Date): Boolean; export function greaterThan(left: Time, right: Time): Boolean; export function greaterThan(left: DateTime, right: DateTime): Boolean; export function greaterThan(left: Decimal, right: Decimal): Boolean; export function greaterThan(left: Long, right: Long): Boolean; export function greaterThanEnums(left: Enums, right: Enums): Boolean; // 数据查询 join 支持枚举类型对比 export const joinGreaterThan: typeof greaterThan & typeof greaterThanEnums export function lessThan(left: Long, right: Long): Boolean; export function lessThan(left: String, right: String): Boolean; export function lessThan(left: Date, right: Date): Boolean; export function lessThan(left: Time, right: Time): Boolean; export function lessThan(left: DateTime, right: DateTime): Boolean; export function lessThan(left: Decimal, right: Decimal): Boolean; export function lessThan(left: Long, right: Long): Boolean; export function lessThanEnums(left: Enums, right: Enums): Boolean; // 数据查询 join 支持枚举类型对比 export const joinLessThan: typeof lessThan & typeof lessThanEnums export function greaterThanOrEqual(left: Long, right: Long): Boolean; export function greaterThanOrEqual(left: String, right: String): Boolean; export function greaterThanOrEqual(left: Date, right: Date): Boolean; export function greaterThanOrEqual(left: Time, right: Time): Boolean; export function greaterThanOrEqual(left: DateTime, right: DateTime): Boolean; export function greaterThanOrEqual(left: Decimal, right: Decimal): Boolean; export function greaterThanOrEqual(left: Long, right: Long): Boolean; export function greaterThanOrEqualEnums(left: Enums, right: Enums): Boolean; // 数据查询 join 支持枚举类型对比 export const joinGreaterThanOrEqual: typeof greaterThanOrEqual & typeof greaterThanOrEqualEnums export function lessThanOrEqual(left: Long, right: Long): Boolean; export function lessThanOrEqual(left: String, right: String): Boolean; export function lessThanOrEqual(left: Date, right: Date): Boolean; export function lessThanOrEqual(left: Time, right: Time): Boolean; export function lessThanOrEqual(left: DateTime, right: DateTime): Boolean; export function lessThanOrEqual(left: Decimal, right: Decimal): Boolean; export function lessThanOrEqual(left: Long, right: Long): Boolean; export function lessThanOrEqualEnums(left: Enums, right: Enums): Boolean; // 数据查询 join 支持枚举类型对比 export const joinLessThanOrEqual: typeof lessThanOrEqual & typeof lessThanOrEqualEnums export function ensureBoolean(value: Boolean): Boolean; export function ensureVoid(value: IsVoid): Boolean export function isUnionType(obj: T): obj is S; // 代替原来的赋值语句,就只校验左右类型是不是可以赋值,但是不会改变原始类型 export function assign(left: T1, right: T2): T1; export let universalVariable: nasl.core.Any; // new 组件对比类型 export function compareNew(left: Date, right: Date): Boolean; export function compareNew(left: Time, right: Time): Boolean; export function compareNew(left: DateTime, right: DateTime): Boolean; export function compareNew(left: Long, right: Long): Boolean; export function compareNew(left: Long, right: Decimal): Boolean; export function compareNew(left: Decimal, right: Long): Boolean; export function compareNew(left: String, right: String): Boolean; export function compareNew(left: Decimal, right: Decimal): Boolean; export function compareNew(left: T, right: T): Boolean; // OQL 临时补救 export function compare2(left: Date, right: String): Boolean; export function compare2(left: DateTime, right: String): Boolean; export function compare2(left: String, right: Date): Boolean; export function compare2(left: String, right: DateTime): Boolean; export function compare2(left: String, right: Time): Boolean; export function compare2(left: String, right: Decimal): Boolean; export function compare2(left: Date, right: Date): Boolean; export function compare2(left: Time, right: Time): Boolean; export function compare2(left: DateTime, right: DateTime): Boolean; export function compare2(left: String, right: String): Boolean; export function compare2(left: Long, right: Long): Boolean; export function compare2(left: Long, right: Decimal): Boolean; export function compare2(left: Decimal, right: Long): Boolean; export function compare2(left: Decimal, right: Decimal): Boolean; export function compare2(left: Decimal, right: String): Boolean; export function compare2(left: T, right: T): Boolean; // 包括 + export function add2(left: Long, right: Long): Long; export function add2(left: Decimal, right: Decimal): Decimal; export function add2(left: Long, right: Long): Long; export function add2(left: Long, right: Decimal): Decimal; export function add2(left: Decimal, right: Long): Decimal; export function add2(left: String, right: Any): String; export function add2(left: Any, right: String): String; export function add2(left: Long, right: Long): Long; // 为了让提示到整数上,最后补一个重载 // 包括 - * % export function arith2(left: Long, right: Long): Long; export function arith2(left: Decimal, right: Decimal): Decimal; export function arith2(left: Long, right: Decimal): Decimal; export function arith2(left: Decimal, right: Long): Decimal; export function arith2(left: Long, right: Long): Long; // 为了让提示到整数上,最后补一个重载 // 包括 / export function divided2(left: Long, right: Long): Decimal; export function divided2(left: Decimal, right: Decimal): Decimal; export function divided2(left: Long, right: Decimal): Decimal; export function divided2(left: Decimal, right: Long): Decimal; export function divided2(left: Long, right: Long): Decimal; // 为了让提示到整数上,最后补一个重载 export class Enums< in out T1 extends Long | String> { accept: 'Enums'; internal?: T1; } export class None { accept: 'None'; } export type Incompatible = A extends B ? never : A export type IsVoid = T extends void ? never : T export type IfAny = 0 extends (1 & T) ? Y : N; export type IsAny = IfAny; export class Function extends globalThis.Function { } export type _AStructure = { [K in keyof T]: T[K]; }; export type AStructure = _AStructure; export function makeAStructure(value: T): MakeAStructure; export type MakeAStructure = IsAny extends true ? any : T extends nasl.ui.CurrentDynamic ? nasl.ui.CurrentDynamic, MakeAStructure> : T extends nasl.ui.Current ? nasl.ui.Current> : T extends nasl.collection.List ? nasl.collection.List> : T extends nasl.core.Primitive ? T : T extends { __name: string } ? T : AStructure; export type DelAStructure = T extends AStructure ? DelAStructure : T extends nasl.collection.List ? nasl.collection.List> : T extends nasl.collection.Map ? nasl.collection.Map, DelAStructure> : T extends (...args: any[]) => any ? T : T extends Primitive ? T : T extends { __name: string } ? T : { [K in keyof T]: DelAStructure; }; } type BooleanAlias = Boolean; type StringAlias = String;