Make getAwaitedType
private
Also, fix an additional baseline change and break up huge line.
This commit is contained in:
parent
0503da225d
commit
ba02f4303e
|
@ -3421,6 +3421,7 @@ namespace ts {
|
|||
getWidenedType(type: Type): Type;
|
||||
/* @internal */
|
||||
getPromisedTypeOfPromise(promise: Type, errorNode?: Node): Type | undefined;
|
||||
/* @internal */
|
||||
getAwaitedType(type: Type): Type | undefined;
|
||||
getReturnTypeOfSignature(signature: Signature): Type;
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,11 @@ namespace ts.codefix {
|
|||
}
|
||||
const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info;
|
||||
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, returnTypeNode, promisedTypeNode));
|
||||
return [createCodeFixAction(fixId, changes, [Diagnostics.Replace_0_with_Promise_1, checker.typeToString(returnType), checker.typeToString(promisedType)], fixId, Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions)];
|
||||
return [createCodeFixAction(
|
||||
fixId, changes,
|
||||
[Diagnostics.Replace_0_with_Promise_1,
|
||||
checker.typeToString(returnType), checker.typeToString(promisedType)],
|
||||
fixId, Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions)];
|
||||
},
|
||||
getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => {
|
||||
const info = getInfo(diag.file, context.program.getTypeChecker(), diag.start);
|
||||
|
|
|
@ -2035,7 +2035,6 @@ declare namespace ts {
|
|||
getBaseTypes(type: InterfaceType): BaseType[];
|
||||
getBaseTypeOfLiteralType(type: Type): Type;
|
||||
getWidenedType(type: Type): Type;
|
||||
getAwaitedType(type: Type): Type | undefined;
|
||||
getReturnTypeOfSignature(signature: Signature): Type;
|
||||
getNullableType(type: Type, flags: TypeFlags): Type;
|
||||
getNonNullableType(type: Type): Type;
|
||||
|
|
|
@ -2035,7 +2035,6 @@ declare namespace ts {
|
|||
getBaseTypes(type: InterfaceType): BaseType[];
|
||||
getBaseTypeOfLiteralType(type: Type): Type;
|
||||
getWidenedType(type: Type): Type;
|
||||
getAwaitedType(type: Type): Type | undefined;
|
||||
getReturnTypeOfSignature(signature: Signature): Type;
|
||||
getNullableType(type: Type, flags: TypeFlags): Type;
|
||||
getNonNullableType(type: Type): Type;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(3,17): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(6,24): error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(6,24): error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<string>'?
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(7,23): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(10,24): error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(10,24): error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<string>'?
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(12,2): error TS2322: Type '0' is not assignable to type 'string'.
|
||||
tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(19,3): error TS2345: Argument of type '() => Promise<number>' is not assignable to parameter of type '() => string'.
|
||||
Type 'Promise<number>' is not assignable to type 'string'.
|
||||
|
@ -17,7 +17,7 @@ tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(19,3): error TS2
|
|||
// Error (good)
|
||||
/** @type {function(): string} */
|
||||
~~~~~~
|
||||
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<string>'?
|
||||
const b = async () => 0
|
||||
~
|
||||
!!! error TS2322: Type '0' is not assignable to type 'string'.
|
||||
|
@ -25,7 +25,7 @@ tests/cases/conformance/async/es2017/asyncArrowFunction/file.js(19,3): error TS2
|
|||
// No error (bad)
|
||||
/** @type {function(): string} */
|
||||
~~~~~~
|
||||
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type. Did you mean to write 'Promise<string>'?
|
||||
const c = async () => {
|
||||
return 0
|
||||
~~~~~~~~
|
||||
|
|
Loading…
Reference in a new issue