Skip to content

Failed to access the interface behind it when intersecting an interface with the same key. #56777

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

Closed
etch-cure opened this issue Dec 14, 2023 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@etch-cure
Copy link

🔎 Search Terms

interface intersection type

🕗 Version & Regression Information

  • This is a crash
  • This changed between versions ______ and _______
  • This changed in commit or PR _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______

⏯ Playground Link

https://www.typescriptlang.org/play?#code/JYOwLgpgTgZghgYwgAgEIFcxgPYgApxRwC2yA3gFDLLYBGAVgNIQCeAXMgM5hSgDmAbipcwLADYQO3XiEHCIANwjgpPfkIC+FCqEixEKAMoQwxiQjDBcBIqUrVOEc5dycOGLNcIkA2gF1NbV1oeCRkABUIAA9TEzMICysQcmFHZyS3cmQxOFonVRk+ZA1-QIpogAdsKDBkYP0wgDF0MTFjWPTcFOoK72IOdvjEr1tkADII6NiOhJcQCi0KBFda6JIKiWbWwadZpI4ttrjd4eSAXm7kXtsOe2ouE7nMn2F7y7fqOiZWDgByX4ANK8PtxxJJkL8ACYQeAtMAABkBwLeimUYD+SI+9xyeTEfwA8hU5sgAIy-ZHFIFYu5Yr7MdgQzFYkRgv7Q2FiBFMrGolSMqnMnH5CGE4lkilaLEAeilyEAN6OABjrAAujyEAKs3IQBznYABceQgAJBwC7C8hALargEqu5CAFNnAAA1yEtgFKm4F+YRaDRCcpRdabFpHGanAB01xIvrSe1cvpg1QAoogABYACgUcDE6BQZwAfMgE0mIL6hWIAJRAA

💻 Code

interface ButtonParam {
  objKey: string;
  style: string;
  event: string;
}

interface SetSelectionParam {
  selections: ButtonParam[];
}

interface TextSetSelection {
  selections: { label: string }[];
}

export interface FullSetSelection {
  param: SetSelectionParam & TextSetSelection
}

const exampleFullSetSelection: FullSetSelection = {
  param: {
    selections: [
      {
        objKey: '',
        style: 'default0',
        event: '',
        label: 'Option 1'
      },
      {
        objKey: '',
        style: 'default0',
        event: '',
        label: 'Option 1'
      }
    ]
  }
};

exampleFullSetSelection.param.selections.forEach(value => value.label)

🙁 Actual behavior

exampleFullSetSelection.param.selections.forEach(value => value.label)

in here, it can not access value.label.

🙂 Expected behavior

exampleFullSetSelection.param.selections.forEach(value => value.label)

in here, it can access value.label.

Additional information about the issue

No response

@jcalz
Copy link
Contributor

jcalz commented Dec 14, 2023

Duplicate of #41874

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Dec 14, 2023
@typescript-bot
Copy link
Collaborator

This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 17, 2023
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

4 participants