true-myth
Version:
A library for safe functional programming in JavaScript, with first-class support for TypeScript
49 lines • 1.81 kB
TypeScript
import { RuleContext, RuleDefinition } from '@eslint/core';
import type { TSESTree } from '@typescript-eslint/utils';
import ts from 'typescript';
import Maybe from 'true-myth/maybe';
interface NamedRuleDefinition extends RuleDefinition {
name: string;
}
export declare function createRule(rule: NamedRuleDefinition): RuleDefinition;
interface TypedParserServices {
esTreeNodeToTSNodeMap: {
get(node: TSESTree.Node): ts.Node;
};
getTypeAtLocation(node: TSESTree.Node): ts.Type;
program: ts.Program;
}
export declare function getTypedParserServices(context: RuleContext): TypedParserServices;
export type Export = {
kind: 'default';
} | {
kind: 'named';
name: string;
};
export interface MustUseType {
module: string;
export: Export;
}
export declare class Obligation {
readonly symbol: ts.Symbol;
readonly type: MustUseType;
private readonly equivalentTypes;
constructor(symbol: ts.Symbol, type: MustUseType);
get label(): string;
addEquivalentType(type: MustUseType): void;
matches(type: MustUseType): boolean;
}
export declare function mustUseTypesFrom(value: unknown, optionName?: string): MustUseType[];
export declare function sameMustUseType(left: MustUseType, right: MustUseType): boolean;
export declare class Resolver {
private readonly checker;
private readonly obligations;
constructor(program: ts.Program, checker: ts.TypeChecker, types: MustUseType[]);
obligationFor(type: ts.Type, seen?: Set<ts.Type>): Maybe<Obligation>;
private addTypes;
canonicalSymbol(symbol: ts.Symbol, seen?: Set<ts.Symbol>): ts.Symbol;
}
export declare const TRUE_MYTH_MUST_USE_TYPES: MustUseType[];
export declare const TRUE_MYTH_MUST_AWAIT_TYPES: MustUseType[];
export {};
//# sourceMappingURL=true-myth-support.d.ts.map