Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

array in conditional type issue #57881

Closed
marc0n3 opened this issue Mar 21, 2024 · 1 comment
Closed

array in conditional type issue #57881

marc0n3 opened this issue Mar 21, 2024 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@marc0n3
Copy link

marc0n3 commented Mar 21, 2024

Hi this is the code to reproduce the issue

class Item{
    name:string
}
abstract class ItemContainer{
    items: Item[]
}

class Drawer extends ItemContainer{
    size:number
}




type ArrayInnerType< A> =  A extends (infer inferred)[]?inferred:A;



class Manager<T extends ItemContainer>{
    manage(object:T){
        type rightType = ArrayInnerType<ItemContainer["items"]>;
        type wrongType =ArrayInnerType<T["items"]>;
        //   ^?
    }
}

I expect the type of wrongType to be Item but it is (inferred & inferred[]) | T["items"]

can you help me understand why?
Thanks

@marc0n3 marc0n3 added the Duplicate An existing issue was already created label Mar 21, 2024
@RyanCavanaugh
Copy link
Member

To expedite the triage process, we need everyone to follow the issue template and instructions.

When you clicked "Create New Issue", the issue form was pre-populated with a template and some instructions. We need you to read those instructions completely, follow them, and then fill in all the fields in that template.

We are not able to assist with issues that don't follow the template instructions as they represent a significantly larger amount of work compared to issues which are correctly specified. Thank you for understanding.

@RyanCavanaugh RyanCavanaugh closed this as not planned Won't fix, can't repro, duplicate, stale Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants