mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 20:51:43 -06:00
Code review comments
This commit is contained in:
parent
b4baee492f
commit
9ff66fbb5e
@ -13428,7 +13428,7 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const onfulfilledParameterType = getUnionType(map(thenSignatures, getTypeOfFirstParameterOfSignature));
|
||||
const onfulfilledParameterType = getTypeWithFacts(getUnionType(map(thenSignatures, getTypeOfFirstParameterOfSignature)), TypeFacts.NEUndefined);
|
||||
if (onfulfilledParameterType.flags & TypeFlags.Any) {
|
||||
return undefined;
|
||||
}
|
||||
@ -13443,7 +13443,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getTypeOfFirstParameterOfSignature(signature: Signature) {
|
||||
return getTypeWithFacts(getTypeAtPosition(signature, 0), TypeFacts.NEUndefined);
|
||||
return getTypeAtPosition(signature, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -15,6 +15,15 @@ declare namespace Windows.Foundation {
|
||||
async function sample(promise: Windows.Foundation.IPromise<number>) {
|
||||
var number = await promise;
|
||||
}
|
||||
|
||||
|
||||
declare function resolve1<T>(value: T): Promise<T>;
|
||||
declare function resolve2<T>(value: T): Windows.Foundation.IPromise<T>;
|
||||
|
||||
async function sample2(x?: number) {
|
||||
let x1 = await resolve1(x);
|
||||
let x2 = await resolve2(x);
|
||||
}
|
||||
|
||||
|
||||
//// [asyncFunctionsAndStrictNullChecks.js]
|
||||
@ -31,3 +40,9 @@ function sample(promise) {
|
||||
var number = yield promise;
|
||||
});
|
||||
}
|
||||
function sample2(x) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let x1 = yield resolve1(x);
|
||||
let x2 = yield resolve2(x);
|
||||
});
|
||||
}
|
||||
|
||||
@ -100,3 +100,37 @@ async function sample(promise: Windows.Foundation.IPromise<number>) {
|
||||
>promise : Symbol(promise, Decl(asyncFunctionsAndStrictNullChecks.ts, 13, 22))
|
||||
}
|
||||
|
||||
|
||||
declare function resolve1<T>(value: T): Promise<T>;
|
||||
>resolve1 : Symbol(resolve1, Decl(asyncFunctionsAndStrictNullChecks.ts, 15, 1))
|
||||
>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 26))
|
||||
>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 29))
|
||||
>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 26))
|
||||
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 26))
|
||||
|
||||
declare function resolve2<T>(value: T): Windows.Foundation.IPromise<T>;
|
||||
>resolve2 : Symbol(resolve2, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 51))
|
||||
>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 19, 26))
|
||||
>value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 19, 29))
|
||||
>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 19, 26))
|
||||
>Windows : Symbol(Windows, Decl(asyncFunctionsAndStrictNullChecks.ts, 0, 0))
|
||||
>Foundation : Symbol(Windows.Foundation, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 26))
|
||||
>IPromise : Symbol(Windows.Foundation.IPromise, Decl(asyncFunctionsAndStrictNullChecks.ts, 1, 38))
|
||||
>T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 19, 26))
|
||||
|
||||
async function sample2(x?: number) {
|
||||
>sample2 : Symbol(sample2, Decl(asyncFunctionsAndStrictNullChecks.ts, 19, 71))
|
||||
>x : Symbol(x, Decl(asyncFunctionsAndStrictNullChecks.ts, 21, 23))
|
||||
|
||||
let x1 = await resolve1(x);
|
||||
>x1 : Symbol(x1, Decl(asyncFunctionsAndStrictNullChecks.ts, 22, 7))
|
||||
>resolve1 : Symbol(resolve1, Decl(asyncFunctionsAndStrictNullChecks.ts, 15, 1))
|
||||
>x : Symbol(x, Decl(asyncFunctionsAndStrictNullChecks.ts, 21, 23))
|
||||
|
||||
let x2 = await resolve2(x);
|
||||
>x2 : Symbol(x2, Decl(asyncFunctionsAndStrictNullChecks.ts, 23, 7))
|
||||
>resolve2 : Symbol(resolve2, Decl(asyncFunctionsAndStrictNullChecks.ts, 18, 51))
|
||||
>x : Symbol(x, Decl(asyncFunctionsAndStrictNullChecks.ts, 21, 23))
|
||||
}
|
||||
|
||||
|
||||
@ -101,3 +101,41 @@ async function sample(promise: Windows.Foundation.IPromise<number>) {
|
||||
>promise : Windows.Foundation.IPromise<number>
|
||||
}
|
||||
|
||||
|
||||
declare function resolve1<T>(value: T): Promise<T>;
|
||||
>resolve1 : <T>(value: T) => Promise<T>
|
||||
>T : T
|
||||
>value : T
|
||||
>T : T
|
||||
>Promise : Promise<T>
|
||||
>T : T
|
||||
|
||||
declare function resolve2<T>(value: T): Windows.Foundation.IPromise<T>;
|
||||
>resolve2 : <T>(value: T) => Windows.Foundation.IPromise<T>
|
||||
>T : T
|
||||
>value : T
|
||||
>T : T
|
||||
>Windows : any
|
||||
>Foundation : any
|
||||
>IPromise : Windows.Foundation.IPromise<TResult>
|
||||
>T : T
|
||||
|
||||
async function sample2(x?: number) {
|
||||
>sample2 : (x?: number | undefined) => Promise<void>
|
||||
>x : number | undefined
|
||||
|
||||
let x1 = await resolve1(x);
|
||||
>x1 : number | undefined
|
||||
>await resolve1(x) : number | undefined
|
||||
>resolve1(x) : Promise<number | undefined>
|
||||
>resolve1 : <T>(value: T) => Promise<T>
|
||||
>x : number | undefined
|
||||
|
||||
let x2 = await resolve2(x);
|
||||
>x2 : number | undefined
|
||||
>await resolve2(x) : number | undefined
|
||||
>resolve2(x) : Windows.Foundation.IPromise<number | undefined>
|
||||
>resolve2 : <T>(value: T) => Windows.Foundation.IPromise<T>
|
||||
>x : number | undefined
|
||||
}
|
||||
|
||||
|
||||
@ -16,3 +16,12 @@ declare namespace Windows.Foundation {
|
||||
async function sample(promise: Windows.Foundation.IPromise<number>) {
|
||||
var number = await promise;
|
||||
}
|
||||
|
||||
|
||||
declare function resolve1<T>(value: T): Promise<T>;
|
||||
declare function resolve2<T>(value: T): Windows.Foundation.IPromise<T>;
|
||||
|
||||
async function sample2(x?: number) {
|
||||
let x1 = await resolve1(x);
|
||||
let x2 = await resolve2(x);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user