Support code-fix-all for importFixes (#25137)

* Support code-fix-all for importFixes

* Change description

* Update API (#25283)
This commit is contained in:
Andy
2018-07-03 15:19:15 -07:00
committed by GitHub
parent 726412cf6a
commit 064ecd449e
12 changed files with 369 additions and 268 deletions

View File

@@ -531,7 +531,7 @@ namespace ts {
return result;
}
export function flatMapIterator<T, U>(iter: Iterator<T>, mapfn: (x: T) => U[] | Iterator<U> | undefined): Iterator<U> {
export function flatMapIterator<T, U>(iter: Iterator<T>, mapfn: (x: T) => ReadonlyArray<U> | Iterator<U> | undefined): Iterator<U> {
const first = iter.next();
if (first.done) {
return emptyIterator;
@@ -1418,7 +1418,9 @@ namespace ts {
return typeof text === "string";
}
export function tryCast<TOut extends TIn, TIn = any>(value: TIn | undefined, test: (value: TIn) => value is TOut): TOut | undefined {
export function tryCast<TOut extends TIn, TIn = any>(value: TIn | undefined, test: (value: TIn) => value is TOut): TOut | undefined;
export function tryCast<T>(value: T, test: (value: T) => boolean): T | undefined;
export function tryCast<T>(value: T, test: (value: T) => boolean): T | undefined {
return value !== undefined && test(value) ? value : undefined;
}

View File

@@ -4474,5 +4474,9 @@
"Add missing enum member '{0}'": {
"category": "Message",
"code": 95063
},
"Add all missing imports": {
"category": "Message",
"code": 95064
}
}

View File

@@ -4312,8 +4312,8 @@ namespace ts {
return !!forEachAncestorDirectory(directory, d => callback(d) ? true : undefined);
}
export function isUMDExportSymbol(symbol: Symbol | undefined) {
return symbol && symbol.declarations && symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
export function isUMDExportSymbol(symbol: Symbol | undefined): boolean {
return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
}
export function showModuleSpecifier({ moduleSpecifier }: ImportDeclaration): string {
@@ -8106,4 +8106,6 @@ namespace ts {
return findBestPatternMatch(patterns, _ => _, candidate);
}
export type Mutable<T extends object> = { -readonly [K in keyof T]: T[K] };
}