Repository navigation
Incorrect type inference in promise.all #35626
Copy link
Copy link
Closed
Labels
Needs InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.RescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
Milestone
Description
Activity
Possibly related to #34937
Reproduced in 3.7.2 and 3.7.3.
Works correctly in 3.6.
possible duplicate of #33752
Link to reproduce this - even in nightly builds:
- addedNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.
on Dec 18, 2019 Not sure, if this is the same problem or just related:
class C1 { data1: number; } class C2 extends C1 { data2: number; } async test(): Promise<number> { let [c2, c1] = await Promise.all([ Promise.resolve(<C2[]>[new C2()]), Promise.resolve(<C1[]>[new C1()]), ]); return c2[0].data2; }
-> Error TS2551: Property 'data2' does not exist on type 'C1'. Did you mean 'data1'?
Works correctly with 3.6 but not with 3.7
- addedRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
on Aug 31, 2020 This may have been fixed by #34501, as it does not seem to occur in TypeScript 3.9 onward.
Metadata
Metadata
Assignees
Labels
Needs InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.RescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
TypeScript Version: 3.7.x-dev.201xxxxx
Search Terms:
Code
Expected behavior:
Works correctly in typescript 3.6.4, but failed to compile in typescript@latest and typescript@next with error
Argument of type 'B | undefined' is not assignable to parameter of type 'B'.