import { TSDeclareFunction, TSInterfaceDeclaration, TSTypeAliasDeclaration, TSEnumDeclaration, TSModuleDeclaration, Statement, TSModuleBlock, TSCallSignatureDeclaration, TSFunctionType, TSConstructSignatureDeclaration, TSMethodSignature, TSType, TSPropertySignature, TSMappedType, TSInterfaceBody, TSTypeLiteral, TSIntersectionType, TSTypeElement, TSParenthesizedType, Identifier, TSEntityName } from '@babel/types'; type TSDeclaration = TSDeclareFunction | TSInterfaceDeclaration | TSTypeAliasDeclaration | TSEnumDeclaration | TSModuleDeclaration; interface TSFile { filePath: string; content: string; ast: Statement[]; } type TSScope = TSFile | TSResolvedType; interface TSProperties { callSignatures: Array>; constructSignatures: Array>; methods: Record>>; properties: Record | null; optional: boolean; signature: TSResolvedType; }>; } declare const tsFileCache: Record; declare function getTSFile(filePath: string): Promise; declare function isTSDeclaration(node: any): node is TSDeclaration; declare function mergeTSProperties(a: TSProperties, b: TSProperties): TSProperties; /** * get properties of `interface` or `type` declaration * * @limitation don't support index signature */ declare function resolveTSProperties({ type, scope, }: TSResolvedType): Promise; /** * @limitation don't support index signature */ declare function resolveTypeElements(scope: TSScope, elements: Array): TSProperties; interface TSResolvedType | Exclude> { scope: TSScope; type: T; } /** * Resolve a reference to a type. * * Supports `type` and `interface` only. * * @limitation don't support non-TS declaration (e.g. class, function...) */ declare function resolveTSReferencedType(ref: TSResolvedType, stacks?: TSResolvedType[]): Promise; declare function resolveTSScope(scope: TSScope): { isFile: boolean; file: TSFile; body: Statement[]; }; declare function resolveTSEntityName(node: TSEntityName): Identifier[]; declare const exportsSymbol: unique symbol; type TSExports = { [K in string]: TSResolvedType | TSExports | undefined; } & { [exportsSymbol]: true; }; declare const tsFileExportsCache: Map; declare function isTSExports(val: unknown): val is TSExports; /** * Get exports of the TS file. * * @limitation don't support non-TS declaration (e.g. class, function...) * @limitation don't support `export default`, since TS don't support it currently. * @limitation don't support `export * as xxx from '...'` (aka namespace). */ declare function resolveTSExports(scope: TSScope): Promise; type ResolveTSFileIdImpl = (id: string, importer: string) => Promise | string | undefined; declare function resolveTSFileId(id: string, importer: string): string | Promise | undefined; /** * @limitation don't node_modules and JavaScript file */ declare function resolveTSFileIdNode(id: string, importer: string): string | undefined; declare function setResolveTSFileIdImpl(impl: ResolveTSFileIdImpl): void; export { ResolveTSFileIdImpl, TSDeclaration, TSExports, TSFile, TSProperties, TSResolvedType, TSScope, exportsSymbol, getTSFile, isTSDeclaration, isTSExports, mergeTSProperties, resolveTSEntityName, resolveTSExports, resolveTSFileId, resolveTSFileIdNode, resolveTSProperties, resolveTSReferencedType, resolveTSScope, resolveTypeElements, setResolveTSFileIdImpl, tsFileCache, tsFileExportsCache };