import type App from './App__'; import type Structure from './Structure__'; import { TranslatorState, TranslatorGenerator } from '@lcap/nasl-translator'; import { ElementToVueOptions } from './ViewElement__'; export declare enum PRIMITIVE_TYPE { Boolean = "Boolean", Integer = "Integer", Long = "Long", Double = "Double", Decimal = "Decimal", String = "String", Text = "Text", Binary = "Binary", Date = "Date", Time = "Time", DateTime = "DateTime", Email = "Email", Union = "Union", Null = "Null", Any = "Any" } export declare const PRIMITIVE_TITLE: Record; export declare const OLD_PRIMITIVE_TITLE: Record; export declare const PRIMITIVE_DESC: Record; export declare const GENERIC_DESC: Record; export declare const REFERENCE_DESC: Record; /** * 判断是否是联合类型 * @param typeAnnotation * @returns */ export declare function isUnion(typeAnnotation: TypeAnnotation): boolean; import BaseNode from '../common/BaseNode'; import type StructureProperty from './StructureProperty__'; /** * 类型标注 */ export declare class TypeAnnotation extends BaseNode { /** 类名 */ static readonly ConceptName: string; /** * 是否为抽象类 * 抽象类不能产生 concept: string */ static isAbstract: boolean; /** 继承链 */ static readonly inheritanceChain: string[]; /** * 产品概念 */ readonly concept: 'TypeAnnotation'; /** * 类型种类 */ typeKind: 'primitive' | 'reference' | 'generic' | 'typeParam' | 'function' | 'union' | 'anonymousStructure' | 'literal' | 'conditional' | 'indexedAccess'; /** * 类型命名空间 */ typeNamespace?: string; /** * 类型名称 */ typeName?: string; /** 泛型专用 */ typeParams?: Array; /** * 类型参数。函数类型的所有 parameter 的类型 */ typeArguments?: Array; /** * 函数类型的参数 * * 名字和类型的二元组列表 /** * @deprecated TODO wudengke 非正式字段。需要扶正 */ fnArgs?: Array<{ name: string; type: TypeAnnotation; spread?: boolean; }>; /** * 返回类型 */ returnType?: Array; /** * 是否是推断出来的 */ inferred?: boolean; /** * 匿名数据结构属性 */ properties?: Array; /** * 规则对象 */ ruleMap?: Record; /** * 是否同步 */ sync?: boolean; /** * @param source 需要合并的部分参数 */ constructor(source?: Partial); static from(source: any, parentNode?: any, parentKey?: string): TypeAnnotation; /** * 设置规则对象 */ setRuleMap(ruleMap: Record): void; /** * 设置是否同步 */ setSync(sync: boolean): void; /** * 插入类型标注 * @internal * @param typeAnnotationOptions 类型标注参数 */ _insertTypeAnnotationInTypeArgumentsAt(typeAnnotationOptions: Partial, index: number): TypeAnnotation; /** * 插入类型标注 * @internal * @param typeAnnotation 已有的类型标注实例 */ _insertTypeAnnotationInTypeArgumentsAt(typeAnnotation: TypeAnnotation, index: number): TypeAnnotation; /** * 插入类型标注 * @param typeAnnotationOptions 类型标注参数 */ insertTypeAnnotationInTypeArgumentsAt(typeAnnotationOptions: Partial, index: number): TypeAnnotation; /** * 插入类型标注 * @param typeAnnotation 已有的类型标注实例 */ insertTypeAnnotationInTypeArgumentsAt(typeAnnotation: TypeAnnotation, index: number): TypeAnnotation; /** * 添加类型标注 * @internal * @param typeAnnotationOptions 类型标注参数 */ _addTypeAnnotationInTypeArguments(typeAnnotationOptions: Partial): TypeAnnotation; /** * 添加类型标注 * @internal * @param typeAnnotation 已有的类型标注实例 */ _addTypeAnnotationInTypeArguments(typeAnnotation: TypeAnnotation): TypeAnnotation; /** * 添加类型标注 * @param typeAnnotationOptions 类型标注参数 */ addTypeAnnotationInTypeArguments(typeAnnotationOptions: Partial): TypeAnnotation; /** * 添加类型标注 * @param typeAnnotation 已有的类型标注实例 */ addTypeAnnotationInTypeArguments(typeAnnotation: TypeAnnotation): TypeAnnotation; /** * 插入类型标注 * @internal * @param typeAnnotationOptions 类型标注参数 */ _insertTypeAnnotationInReturnTypeAt(typeAnnotationOptions: Partial, index: number): TypeAnnotation; /** * 插入类型标注 * @internal * @param typeAnnotation 已有的类型标注实例 */ _insertTypeAnnotationInReturnTypeAt(typeAnnotation: TypeAnnotation, index: number): TypeAnnotation; /** * 插入类型标注 * @param typeAnnotationOptions 类型标注参数 */ insertTypeAnnotationInReturnTypeAt(typeAnnotationOptions: Partial, index: number): TypeAnnotation; /** * 插入类型标注 * @param typeAnnotation 已有的类型标注实例 */ insertTypeAnnotationInReturnTypeAt(typeAnnotation: TypeAnnotation, index: number): TypeAnnotation; /** * 添加类型标注 * @internal * @param typeAnnotationOptions 类型标注参数 */ _addTypeAnnotationInReturnType(typeAnnotationOptions: Partial): TypeAnnotation; /** * 添加类型标注 * @internal * @param typeAnnotation 已有的类型标注实例 */ _addTypeAnnotationInReturnType(typeAnnotation: TypeAnnotation): TypeAnnotation; /** * 添加类型标注 * @param typeAnnotationOptions 类型标注参数 */ addTypeAnnotationInReturnType(typeAnnotationOptions: Partial): TypeAnnotation; /** * 添加类型标注 * @param typeAnnotation 已有的类型标注实例 */ addTypeAnnotationInReturnType(typeAnnotation: TypeAnnotation): TypeAnnotation; /** * 插入数据结构属性 * @internal * @param structurePropertyOptions 数据结构属性参数 */ _insertStructurePropertyAt(structurePropertyOptions: Partial, index: number): StructureProperty; /** * 插入数据结构属性 * @internal * @param structureProperty 已有的数据结构属性实例 */ _insertStructurePropertyAt(structureProperty: StructureProperty, index: number): StructureProperty; /** * 插入数据结构属性 * @param structurePropertyOptions 数据结构属性参数 */ insertStructurePropertyAt(structurePropertyOptions: Partial, index: number): StructureProperty; /** * 插入数据结构属性 * @param structureProperty 已有的数据结构属性实例 */ insertStructurePropertyAt(structureProperty: StructureProperty, index: number): StructureProperty; /** * 添加数据结构属性 * @internal * @param structurePropertyOptions 数据结构属性参数 */ _addStructureProperty(structurePropertyOptions: Partial): StructureProperty; /** * 添加数据结构属性 * @internal * @param structureProperty 已有的数据结构属性实例 */ _addStructureProperty(structureProperty: StructureProperty): StructureProperty; /** * 添加数据结构属性 * @param structurePropertyOptions 数据结构属性参数 */ addStructureProperty(structurePropertyOptions: Partial): StructureProperty; /** * 添加数据结构属性 * @param structureProperty 已有的数据结构属性实例 */ addStructureProperty(structureProperty: StructureProperty): StructureProperty; /** * 删除类型标注 * @param typeAnnotation 已有的类型标注实例 */ removeTypeAnnotationInTypeArguments(typeAnnotation: TypeAnnotation): void; /** * 删除类型标注 * @param typeAnnotation 已有的类型标注实例 */ removeTypeAnnotationInReturnType(typeAnnotation: TypeAnnotation): void; /** * 删除数据结构属性 * @param structureProperty 已有的数据结构属性实例 */ removeStructureProperty(structureProperty: StructureProperty): void; name?: string; /** * @warning 这段代码稍微改改可能页面类型检查整体就会变慢一倍以上 */ static createProtoTypeOnly(source: Partial): TypeAnnotation; static createTypeAnonymousStructure(properties: Array, source?: Partial): TypeAnnotation; static createIndexedType(objectType: TypeAnnotation, indexType: TypeAnnotation, source?: Partial): TypeAnnotation; static createLiteral(literal: TypeAnnotation['literal'], source?: Partial): TypeAnnotation; /** * 类型约束(上界) * 多个则为 union 类型 */ constraints?: TypeAnnotation; /** * dotdotdotParam * ... spread 可变长参数,内置函数没定义啊,只能暂时标在类型上了 */ spread?: boolean; indexType?: TypeAnnotation; objectType?: TypeAnnotation; /** * 在为literal类型时有值 */ literal?: boolean | string | number | bigint; checkType?: TypeAnnotation; extendsType?: TypeAnnotation; trueType?: TypeAnnotation; falseType?: TypeAnnotation; optional?: boolean; longNotInteger: boolean; toUI(state?: TranslatorState, hideDetails?: boolean): string; traverse(callback: (arg: TypeAnnotation) => void, enter: (arg: TypeAnnotation) => void, leave: (arg: TypeAnnotation) => void, onJoin: (arg: TypeAnnotation, arg2: TypeAnnotation) => void): void; get typeKey(): string; get sortedTypeKey(): string; /** * 用于展示的 type 标题 */ get headTitle(): string; /** * 用于展示的 type 标题 */ get typeTitle(): string; /** * 用于展示的 无中文的精简type标题 */ get typeInlineTitle(): string; /** * 用于展示的 纯中文的type 标题 */ get typeChineseTitle(): string; get typeTitleList(): any[]; toUserLevelString(): string | undefined; static createPrimitive(typeName: string, source?: Partial): TypeAnnotation; static createPrimitiveProtoTypeOnly(source: Partial): TypeAnnotation; static createReference(typeName: string, source?: Partial): TypeAnnotation; static createReferenceProtoTypeOnly(source: Partial): TypeAnnotation; static createUnion(first: TypeAnnotation, ...tail: TypeAnnotation[]): TypeAnnotation; static createGeneric(typeName: string, source?: Partial): TypeAnnotation; static createTypeParam(typeName: string, source?: Partial): TypeAnnotation; static createLambdaStructure(typeArguments?: Array, returnType?: Array, source?: Partial): TypeAnnotation; getTokenKeyWithNamespace(): string; /** * 设置类型属性名称 */ setTypeName(typeName: string): void; /** * 设置类型属性名称 */ setTypeNamespace(typeNamespace: string): void; get tsCalleeNamespace(): string; get integration(): import("./Integration__").Integration; get connector(): import("./Connector__").Connector; toVue(state?: ElementToVueOptions): string; toJS(state?: TranslatorState): string; toEmbeddedTS(state?: import("@lcap/nasl-types/out/translator").TranslatorState): TranslatorGenerator; toNaturalTS(state?: import("@lcap/nasl-types/out/translator").TranslatorState): string; toTextualNASL(state?: import("@lcap/nasl-types/out/translator").TranslatorState): string; getDefaultValue(value: string): string; /** * * @param code 233 * */ static recognize(code: string | number): TypeAnnotation; typeArgumentsPush(typeItem: TypeAnnotation): void; isComplexType(): boolean; get sign(): string; /** * 判断2个类型是否一致 * * @deprecated 请使用`TypeAnnotation.isStrictSame()`方法 */ isSame(typeAnnotation: TypeAnnotation): boolean; /** * 类型是否相同 * * @description 递归的严格判断类型是否相等 */ isStrictSame(typeAnnotation: TypeAnnotation): boolean; /** * 如果当前类型与对比类型中有一个为范型则返回true * 否则返回 isStrictSame 对应结果 * @param typeAnnotation */ isSimilarTo(typeAnnotation: TypeAnnotation): boolean; isSystemType(): boolean; /** * 是否和Error类型有关 * 目前产品上对和Error类型有关的定义为: 1.本身就是Error类型; 2.为联合类型,且其中typeArguments中至少有一个typeAnnotation有关Error类型。不将List等类型视为和Error类型有关。 */ isRelatedToErrorType(): boolean; static isRelatedToErrorType(ty: TypeAnnotation): boolean; static isErrorType(ty: TypeAnnotation): boolean; isErrorType(): boolean; hasSystemType(app: App, structureCache?: Set): boolean; getPropertyExistingNames(excludedList?: Array): string[]; getPropertyUniqueName(name?: string): string; _insertPropertyAt(options: string | Partial | StructureProperty, index: number): StructureProperty; _addProperty(options?: string | Partial | StructureProperty): StructureProperty; addProperty(options?: string | Partial | StructureProperty): StructureProperty; /** * 获取类型对应的结构 * @param app * @returns */ getStructure(app: App): any; /** * 收集类型中的属性 * @param app * @param prefix * @param propertyMap * @param depth * @returns */ collectPropertyMap(app: App, prefix?: string, propertyMap?: Map, depth?: number): Map; } export default TypeAnnotation; //# sourceMappingURL=TypeAnnotation__.d.ts.map