UNPKG

@patryk-w-bl/ts-migrate-server

Version:

A package that contains the main migration runner and spawns a TSServer process

31 lines (30 loc) 1.06 kB
import ts from 'typescript'; export declare type Nullable<T> = T | null | undefined; export interface PluginParams<TPluginOptions> { options: TPluginOptions; fileName: string; rootDir: string; text: string; sourceFile: ts.SourceFile; getLanguageService: () => ts.LanguageService; } export declare type PluginResult = string | void; export interface LintConfig { useTabs: boolean; tabWidth: number; } export interface Plugin<TPluginOptions = unknown> { name: string; run(params: PluginParams<TPluginOptions>, lintConfig?: LintConfig): Promise<PluginResult> | PluginResult; /** * Returns true if options is a valid options object for this plugin. * If options is invalid, it throws a PluginOptionsError. * * This method should be implemented if TPluginOptions is anything other than unknown. */ validate?(options: unknown): options is TPluginOptions; } export declare type PluginWithOptions<TPluginOptions = unknown> = { plugin: Plugin<TPluginOptions>; options: TPluginOptions; };