UNPKG

@ts-for-gir/lib

Version:

Typescript .d.ts generator from GIR for gjs

50 lines (49 loc) 2.7 kB
import { IntrospectedNamespace } from "./namespace.js"; import { GirDirection, GirAliasElement, GirDocElement, GirInfoAttrs, GirConstantElement, GirCallableReturn, GirFieldElement } from "@gi.ts/parser"; import { TypeIdentifier, TypeExpression } from "../gir.js"; import { Metadata } from "./base.js"; import { IntrospectedBaseClass } from "./class.js"; export declare function getAliasType(namespace: string, ns: IntrospectedNamespace, parameter: GirAliasElement): TypeExpression; export declare function getType(ns: IntrospectedNamespace, param?: GirConstantElement | GirCallableReturn | GirFieldElement): TypeExpression; export declare const SanitizedIdentifiers: Map<string, string>; export declare function sanitizeIdentifierName(namespace: string | null, name: string): string; export declare function sanitizeNamespace(namespace: string): string; export declare function sanitizeMemberName(name: string): string; export declare function isInvalid(name: string): boolean; export declare function parseDoc(element: GirDocElement): string | null; export declare function parseDeprecatedDoc(element: GirDocElement): string | null; export declare function parseMetadata(element: { $: GirInfoAttrs; } & GirDocElement): Metadata | undefined; export declare function parseTypeString(type: string): { namespace: string | null; name: string; }; export declare function parseTypeIdentifier(namespace: string, type: string): TypeIdentifier; export declare function parseTypeExpression(namespace: string, type: string): TypeExpression; export declare function resolvePrimitiveArrayType(name: string, arrayDepth: number): [TypeExpression, number] | null; export declare function isPrimitiveType(name: string): boolean; export declare function resolvePrimitiveType(name: string): TypeExpression | null; export declare function resolveDirectedType(type: TypeExpression, direction: GirDirection): TypeExpression | null; /** * Resolves a class identifier. * * If the identifier is a class type it is returned, * otherwise `null`. * * @param namespace * @param type */ export declare function resolveTypeIdentifier(namespace: IntrospectedNamespace, type: TypeIdentifier): IntrospectedBaseClass | null; /** * Checks if a given type expression in the context of a given this type * is a subtype (compatible with) of another type expression in the context * of a parent type. * * @param namespace * @param thisType * @param parentThisType * @param potentialSubtype * @param parentType */ export declare function isSubtypeOf(namespace: IntrospectedNamespace, thisType: TypeIdentifier, parentThisType: TypeIdentifier, potentialSubtype: TypeExpression, parentType: TypeExpression): boolean;