/** * What a Promise may resolve to. JavaScript resolves a thenable by calling its * `then`, so a value that carries one — a data field, a getter, a method, * anywhere in a union or behind an optional — would be executed instead of * delivered. This module is the one place that decides whether a type carries * that hazard, whether the lowering needs a runtime guard for it, and what the * refusal says. * * D114 R1f: the family reaches three statement heads — a `return`, an async * `def`, and an `extern` declaration's result — so it is its own module rather * than a private half of any one of them. */ import { type Diagnostic } from "../../diagnostic.ts"; import { type Span } from "../../source.ts"; import { type ValueType } from "../../types.ts"; import { type ClassField } from "../../contracts.ts"; /** * Everything the async-result rules ask of the analyzer that hosts them, and * nothing more. The reported set is a live read: one hazard per span, whichever * declaration reaches the span first. */ export interface AsyncResultsHost { expandAliases(type: ValueType, seen?: ReadonlySet): ValueType; fieldsOf(identity: string): ReadonlyMap | null; findField(className: string, name: string): ClassField | null; findGetter(className: string, name: string): { readonly owner: string; readonly type: ValueType; readonly abstract: boolean; } | null; findMethod(className: string, name: string): { readonly owner: string; readonly type: ValueType; readonly abstract: boolean; } | null; readonly diagnostics: Diagnostic[]; readonly reportedPromiseResolutionHazards: Set; resolveNamedClasses(type: ValueType): ValueType; } export declare class AsyncResults { private readonly host; constructor(host: AsyncResultsHost); asyncResultContainsPromise(type: ValueType): boolean; private callableThenMember; promiseResolutionHazard(type: ValueType): string | null; promiseResolutionNeedsRuntimeGuard(type: ValueType): boolean; reportPromiseResolutionHazard(type: ValueType, errorSpan: Span): void; reportPromiseCarrierHazard(type: ValueType, errorSpan: Span): void; } //# sourceMappingURL=async-results.d.ts.map