@@ -596,3 +596,63 @@ async function mainFindMany() {
596596>include : Symbol(include, Decl(awaitedType.ts, 225, 41))
597597}
598598
599+ // repro from #41831
600+
601+ {
602+ const promises = [Promise.resolve(0)] as const
603+ >promises : Symbol(promises, Decl(awaitedType.ts, 231, 7))
604+ >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
605+ >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
606+ >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
607+ >const : Symbol(const)
608+
609+ Promise.all(promises).then((results) => {
610+ >Promise.all(promises).then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
611+ >Promise.all : Symbol(PromiseConstructor.all, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
612+ >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
613+ >all : Symbol(PromiseConstructor.all, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
614+ >promises : Symbol(promises, Decl(awaitedType.ts, 231, 7))
615+ >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
616+ >results : Symbol(results, Decl(awaitedType.ts, 233, 30))
617+
618+ const first = results[0]
619+ >first : Symbol(first, Decl(awaitedType.ts, 234, 9))
620+ >results : Symbol(results, Decl(awaitedType.ts, 233, 30))
621+ >0 : Symbol(0)
622+
623+ const second = results[1] // error
624+ >second : Symbol(second, Decl(awaitedType.ts, 235, 9))
625+ >results : Symbol(results, Decl(awaitedType.ts, 233, 30))
626+
627+ })
628+ }
629+
630+ // repro from #40330
631+
632+ async function test40330() {
633+ >test40330 : Symbol(test40330, Decl(awaitedType.ts, 237, 1))
634+
635+ const promiseNumber = Promise.resolve(1);
636+ >promiseNumber : Symbol(promiseNumber, Decl(awaitedType.ts, 243, 9))
637+ >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
638+ >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
639+ >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
640+
641+ const promiseVoid = async () => {}
642+ >promiseVoid : Symbol(promiseVoid, Decl(awaitedType.ts, 244, 9))
643+
644+ const res = await Promise.all([
645+ >res : Symbol(res, Decl(awaitedType.ts, 246, 9))
646+ >Promise.all : Symbol(PromiseConstructor.all, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
647+ >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
648+ >all : Symbol(PromiseConstructor.all, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
649+
650+ promiseNumber,
651+ >promiseNumber : Symbol(promiseNumber, Decl(awaitedType.ts, 243, 9))
652+
653+ ...[promiseVoid()]
654+ >promiseVoid : Symbol(promiseVoid, Decl(awaitedType.ts, 244, 9))
655+
656+ ])
657+ }
658+
0 commit comments