import * as tsm from 'ts-morph'; /** * Express a filter for diagnostic errors. * * An array of filters means to ignore only certain errors. It can be one of three things: * * 1. regular expression to match against the error code * 2. the name of an error category * 3. regular expression to match against the file path from which the error arises * * You can also combine a file path with either error code or error category. * * Regular expressions are applied case-insensitive. * * Array items share an OR semantic. * * @example { path: '/foo/bar/.*' } * @example { code: '2\d{2}5' } * @example { category: 'error' } * @example { path: '/foo/bar/.*', code '24.*' } */ export declare type DiagnosticFilter = { path?: string; code?: string; } | { path?: string; category?: DiagnosticCategoryString; }; export declare type DiagnosticCategoryString = 'error' | 'message' | 'warning' | 'suggestion'; /** * */ export declare function applyDiagnosticFilters(diagnosticFilters: DiagnosticFilter[], diagnostics: tsm.Diagnostic[]): tsm.Diagnostic[]; /** * Get the discriminant union properties if any of the given types. * * Requires to be a discriminant union property are: * * 1. Property name common to all types given * 2. Is a literal type * 3. Type is not same as any other same-named property among items * * @remarks * * This is a re-implementation of: * * isDiscriminantProperty * findDiscriminantProperties * * found in: * * https://raw.githubusercontent.com/microsoft/TypeScript/master/src/compiler/checker.ts * * which might be surfaced in ts-morph one day: * * https://github.com/dsherret/ts-morph/issues/880 * */ export declare function getDiscriminantPropertiesOfUnionMembers(members: tsm.Type[]): (tsm.PropertySignature | tsm.MethodSignature)[]; /** * Get the properties of a type, if any. This may return methods or non-methods. * * @remarks * * Overloadeds are discarding, taking only the first declaration found. */ export declare function getProperties(t: tsm.Type): (tsm.PropertySignature | tsm.MethodSignature)[]; /** * Return the first declaration of the symbol, ignoring all others and throwing if no declaration can be found. * * @remarks * * TS has the concept of overloading. For example a function with multiple signatures. */ export declare function getFirstDeclarationOrThrow(symbol: tsm.Symbol): tsm.Node; /** * Get the module path of the given source file. The difference from a file path * is that a module path does not have a file extension and is always in posix format. */ export declare function getSourceFileModulePath(sf: tsm.SourceFile): string; //# sourceMappingURL=ts-helpers.d.ts.map