1/** 2 * Returned by refactor functions when some error message needs to be surfaced to users. 3 * 4 * @internal 5 */ 6export interface RefactorErrorInfo { 7 error: string; 8} 9 10/** 11 * Checks if some refactor info has refactor error info. 12 * 13 * @internal 14 */ 15export function isRefactorErrorInfo(info: unknown): info is RefactorErrorInfo { 16 return (info as RefactorErrorInfo).error !== undefined; 17} 18 19/** 20 * Checks if string "known" begins with string "requested". 21 * Used to match requested kinds with a known kind. 22 * 23 * @internal 24 */ 25export function refactorKindBeginsWith(known: string, requested: string | undefined): boolean { 26 if(!requested) return true; 27 return known.substr(0, requested.length) === requested; 28} 29