causes
API reference for @effx/compiler/lift/causes
causes.ts overview
Exports Grouped by Category
utils
Cause
One applicable reason a declaration cannot be lifted: the registered diagnostic and where it applies.
Signature
declare const Cause: Schema.Struct<{
readonly at: Schema.Struct<{
readonly file: Schema.String
readonly start: Schema.Struct<{ readonly offset: Schema.Int; readonly line: Schema.Int; readonly col: Schema.Int }>
readonly end: Schema.Struct<{ readonly offset: Schema.Int; readonly line: Schema.Int; readonly col: Schema.Int }>
}>
readonly diagnostic: Schema.Struct<{
readonly code: Schema.String
readonly severity: Schema.Literals<readonly ["error", "warning", "info"]>
readonly message: Schema.String
readonly location: Schema.optionalKey<
Schema.Struct<{ readonly file: Schema.String; readonly line: Schema.Int; readonly col: Schema.Int }>
>
readonly related: Schema.optionalKey<
Schema.$Array<Schema.suspend<Schema.Codec<Diagnostic, Diagnostic, never, never>>>
>
}>
}>Cause (type alias)
Signature
type Cause = typeof Cause.TypeUnsupportedSite
An unsupported declaration: its identity, where it starts, and one primary diagnostic with all causes.
Signature
declare const UnsupportedSite: Schema.Struct<{
readonly subject: Schema.String
readonly range: Schema.Struct<{
readonly file: Schema.String
readonly start: Schema.Struct<{ readonly offset: Schema.Int; readonly line: Schema.Int; readonly col: Schema.Int }>
readonly end: Schema.Struct<{ readonly offset: Schema.Int; readonly line: Schema.Int; readonly col: Schema.Int }>
}>
readonly primary: Schema.Struct<{
readonly code: Schema.String
readonly severity: Schema.Literals<readonly ["error", "warning", "info"]>
readonly message: Schema.String
readonly location: Schema.optionalKey<
Schema.Struct<{ readonly file: Schema.String; readonly line: Schema.Int; readonly col: Schema.Int }>
>
readonly related: Schema.optionalKey<
Schema.$Array<Schema.suspend<Schema.Codec<Diagnostic, Diagnostic, never, never>>>
>
}>
}>UnsupportedSite (type alias)
Signature
type UnsupportedSite = typeof UnsupportedSite.TypecauseOrder
Total order over every identifying field: file, start offset, diagnostic code (the §0.6 key), then end offset and message as tie-breaks, so any permutation of the same causes orders identically.
Signature
declare const causeOrder: Order.Order<{
readonly at: {
readonly file: string
readonly start: { readonly offset: number; readonly line: number; readonly col: number }
readonly end: { readonly offset: number; readonly line: number; readonly col: number }
}
readonly diagnostic: {
readonly message: string
readonly code: string
readonly severity: "error" | "warning" | "info"
readonly location?: { readonly file: string; readonly line: number; readonly col: number } | undefined
readonly related?: ReadonlyArray<Diagnostic> | undefined
}
}>unsupportedSite
The unsupported site of subject built from all its causes, or none when there are no causes. Identical
causes (same range, code and message) collapse to one. The primary carries the remaining causes, in order,
as related diagnostics; the declaration is not part of any suggestion.
Signature
declare const unsupportedSite: (
subject: string,
range: SourceRange,
causes: ReadonlyArray<Cause>
) => Option.Option<UnsupportedSite>