import type { CompletionItemKind } from "#enums/completionItemKind";
import type { DiagnosticCategory } from "#enums/diagnosticCategory";
import type { ElementFlags } from "#enums/elementFlags";
import type { ObjectFlags } from "#enums/objectFlags";
import type { TypeFlags } from "#enums/typeFlags";
import type { TypePredicateKind } from "#enums/typePredicateKind";
import type { NodeHandle, Symbol } from "./api.ts";
/**
 * A TypeScript type.
 *
 * Use TypeFlags to determine the specific kind of type and access
 * kind-specific properties. For example:
 *
 * ```ts
 * if (type.flags & TypeFlags.StringLiteral) {
 *     console.log((type as LiteralType).value); // string
 * }
 * ```
 */
export interface Type {
    /** Unique identifier for this type */
    readonly id: number;
    /** Type flags — use to determine the specific kind of type */
    readonly flags: TypeFlags;
    /** Get the symbol associated with this type, if any */
    getSymbol(): Symbol | undefined;
    /** Get the type arguments of the type alias this type was instantiated from, if any */
    getAliasTypeArguments(): readonly Type[];
    /** Get the symbol of the type alias this type was instantiated from, if any */
    getAliasSymbol(): Symbol | undefined;
}
/**
 * Freshable types (TypeFlags.Freshable) - literal types (TypeFlags.Literal) and computed enum types (TypeFlags.Enum).
 */
export interface FreshableType extends Type {
    /** Get the fresh version of this type, if any */
    getFreshType(): FreshableType | undefined;
    /** Get the regular (non-fresh) version of this type, if any */
    getRegularType(): FreshableType | undefined;
}
/** Literal types: StringLiteral, NumberLiteral, BigIntLiteral, BooleanLiteral */
export interface LiteralType extends FreshableType {
    /** The literal value */
    readonly value: string | number | boolean;
}
/** Object types (TypeFlags.Object) */
export interface ObjectType extends Type {
    /** Object flags — use to determine the specific kind of object type */
    readonly objectFlags: ObjectFlags;
}
/** Type references (ObjectFlags.Reference) — e.g. Array<string>, Map<K, V> */
export interface TypeReference extends ObjectType {
    /** Get the generic target type (e.g. Array for Array<string>) */
    getTarget(): Type;
}
/** Interface types — classes and interfaces (ObjectFlags.ClassOrInterface) */
export interface InterfaceType extends TypeReference {
    /** Get all type parameters (outer + local, excluding thisType) */
    getTypeParameters(): readonly Type[];
    /** Get outer type parameters from enclosing declarations */
    getOuterTypeParameters(): readonly Type[];
    /** Get local type parameters declared on this interface/class */
    getLocalTypeParameters(): readonly Type[];
}
/** Tuple types (ObjectFlags.Tuple) */
export interface TupleType extends InterfaceType {
    /** Per-element flags (Required, Optional, Rest, Variadic) */
    readonly elementFlags: readonly ElementFlags[];
    /** Number of initial required or optional elements */
    readonly fixedLength: number;
    /** Whether the tuple is readonly */
    readonly readonly: boolean;
}
/** Union or intersection types (TypeFlags.Union | TypeFlags.Intersection) */
export interface UnionOrIntersectionType extends Type {
    /** Get the constituent types */
    getTypes(): readonly Type[];
}
/** Union types (TypeFlags.Union) */
export interface UnionType extends UnionOrIntersectionType {
}
/** Intersection types (TypeFlags.Intersection) */
export interface IntersectionType extends UnionOrIntersectionType {
}
/** Type parameters (TypeFlags.TypeParameter) */
export interface TypeParameter extends Type {
    /** True if this is the synthetic `this` type of an interface, class, or tuple */
    readonly isThisType?: boolean;
}
/** Index types — keyof T (TypeFlags.Index) */
export interface IndexType extends Type {
    /** Get the target type T in `keyof T` */
    getTarget(): Type;
}
/** Indexed access types — T[K] (TypeFlags.IndexedAccess) */
export interface IndexedAccessType extends Type {
    /** Get the object type T in `T[K]` */
    getObjectType(): Type;
    /** Get the index type K in `T[K]` */
    getIndexType(): Type;
}
/** Conditional types — T extends U ? X : Y (TypeFlags.Conditional) */
export interface ConditionalType extends Type {
    /** Get the check type T in `T extends U ? X : Y` */
    getCheckType(): Type;
    /** Get the extends type U in `T extends U ? X : Y` */
    getExtendsType(): Type;
}
/** Substitution types (TypeFlags.Substitution) */
export interface SubstitutionType extends Type {
    getBaseType(): Type;
    getConstraint(): Type;
}
/** Template literal types (TypeFlags.TemplateLiteral) */
export interface TemplateLiteralType extends Type {
    /** Text segments (always one more than the number of type spans) */
    readonly texts: readonly string[];
    /** Get the types interspersed between text segments */
    getTypes(): readonly Type[];
}
/** String mapping types — Uppercase<T>, Lowercase<T>, etc. (TypeFlags.StringMapping) */
export interface StringMappingType extends Type {
    /** Get the mapped type */
    getTarget(): Type;
}
/** Intrinsic types — any, unknown, string, number, bigint, symbol, void, undefined, null, never, object (TypeFlags.Intrinsic) */
export interface IntrinsicType extends Type {
    /** The intrinsic type name (e.g. "any", "string", "never") */
    readonly intrinsicName: string;
}
/** Base for all type predicates */
export interface TypePredicateBase {
    readonly kind: TypePredicateKind;
    readonly type: Type | undefined;
}
/** `this is T` */
export interface ThisTypePredicate extends TypePredicateBase {
    readonly kind: TypePredicateKind.This;
    readonly parameterName: undefined;
    readonly parameterIndex: undefined;
    readonly type: Type;
}
/** `x is T` */
export interface IdentifierTypePredicate extends TypePredicateBase {
    readonly kind: TypePredicateKind.Identifier;
    readonly parameterName: string;
    readonly parameterIndex: number;
    readonly type: Type;
}
/** `asserts this is T` */
export interface AssertsThisTypePredicate extends TypePredicateBase {
    readonly kind: TypePredicateKind.AssertsThis;
    readonly parameterName: undefined;
    readonly parameterIndex: undefined;
    readonly type: Type | undefined;
}
/** `asserts x is T` */
export interface AssertsIdentifierTypePredicate extends TypePredicateBase {
    readonly kind: TypePredicateKind.AssertsIdentifier;
    readonly parameterName: string;
    readonly parameterIndex: number;
    readonly type: Type | undefined;
}
/** A type predicate — e.g. `x is T` or `asserts x is T` */
export type TypePredicate = ThisTypePredicate | IdentifierTypePredicate | AssertsThisTypePredicate | AssertsIdentifierTypePredicate;
/** An index signature — e.g. `[key: string]: T` */
export interface IndexInfo {
    /** The index key type (e.g. string or number) */
    readonly keyType: Type;
    /** The index value type */
    readonly valueType: Type;
    /** Whether the index signature is readonly */
    readonly isReadonly: boolean;
    /** The index signature declaration, if any */
    readonly declaration?: NodeHandle;
}
export interface CompletionEntryLabelDetails {
    detail?: string;
    description?: string;
}
/** Options for {@link Checker.getCompletionsAtPosition}. */
export interface CompletionOptions {
    triggerCharacter?: string;
    /** Include a `symbol` property on each completion entry. Only populated for symbol-based completions (not keywords or literals). */
    includeSymbol?: boolean;
}
/** A single completion item returned by {@link Checker.getCompletionsAtPosition}. */
export interface CompletionEntry {
    readonly name: string;
    readonly kind?: CompletionItemKind;
    readonly sortText?: string;
    readonly insertText?: string;
    readonly filterText?: string;
    readonly detail?: string;
    readonly labelDetails?: CompletionEntryLabelDetails;
    /** The symbol associated with this completion entry. Only set when `includeSymbol: true` is passed and a symbol is available. */
    readonly symbol?: Symbol;
}
/** The result of {@link Checker.getCompletionsAtPosition}. */
export interface CompletionInfo {
    readonly isIncomplete: boolean;
    readonly entries: readonly CompletionEntry[];
}
/**
 * A diagnostic message from the TypeScript compiler.
 */
export interface Diagnostic {
    /** File name of the source file this diagnostic belongs to, if any */
    readonly fileName?: string;
    /** Start position of the diagnostic */
    readonly pos: number;
    /** End position of the diagnostic */
    readonly end: number;
    /** Diagnostic error code */
    readonly code: number;
    /** Diagnostic category (error, warning, suggestion, message) */
    readonly category: DiagnosticCategory;
    /** Localized diagnostic message text */
    readonly text: string;
    /** Whether this diagnostic highlights unnecessary code */
    readonly reportsUnnecessary?: boolean;
    /** Whether this diagnostic highlights deprecated code */
    readonly reportsDeprecated?: boolean;
    /** Chained diagnostic messages */
    readonly messageChain?: readonly Diagnostic[];
    /** Related diagnostic information */
    readonly relatedInformation?: readonly Diagnostic[];
}
//# sourceMappingURL=types.d.ts.map