forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhelpers.ts
More file actions
25 lines (23 loc) · 822 Bytes
/
helpers.ts
File metadata and controls
25 lines (23 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* @internal */
namespace ts.refactor {
/**
* Returned by refactor functions when some error message needs to be surfaced to users.
*/
export interface RefactorErrorInfo {
error: string;
};
/**
* Checks if some refactor info has refactor error info.
*/
export function isRefactorErrorInfo(info: unknown): info is RefactorErrorInfo {
return (info as RefactorErrorInfo).error !== undefined;
}
/**
* Checks if string "known" begins with string "requested".
* Used to match requested kinds with a known kind.
*/
export function refactorKindBeginsWith(known: string, requested: string | undefined): boolean {
if(!requested) return true;
return known.substr(0, requested.length) === requested;
}
}