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

Tuple issues #49830

Closed
Josh119891 opened this issue Jul 8, 2022 · 2 comments
Closed

Tuple issues #49830

Josh119891 opened this issue Jul 8, 2022 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@Josh119891
Copy link

Bug Report

First time to report issues on typescript...
I am working with Tuple.
The Tuple variable could not directly access the index that larger than its length.
It will show up an error, but it push any types of variable as I want and can access them by for loop.

🔎 Search Terms

Tuple

🕗 Version & Regression Information

image

⏯ Playground Link

Playground link with relevant code

💻 Code

type A =[number,number,number,string];
const a :A = [1,2,3,'1'];
a.push(4)
a.push("123")
a.push("123")
a.push("123")
a.push("123")
a.push("123")

console.log(a.filter((i)=>i===4))

🙁 Actual behavior

It did not show up any error.

🙂 Expected behavior

It should limit the length of array and show error if excceeds

@harry0000
Copy link

Duplicate of #48465

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Jul 8, 2022
@typescript-bot
Copy link
Collaborator

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

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