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 array defined in interface isn't recognized #43392

Closed
nugaon opened this issue Mar 26, 2021 · 2 comments
Closed

Tuple array defined in interface isn't recognized #43392

nugaon opened this issue Mar 26, 2021 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@nugaon
Copy link

nugaon commented Mar 26, 2021

Bug Report

🔎 Search Terms

tuple array interface recognized

🕗 Version & Regression Information

4.1.3

  • This is the behavior in every version I tried
  • I was unable to test this on prior versions because I didn't want to (just kidding I tried out in playground versions).

⏯ Playground Link

Playground link with relevant code

💻 Code

type Conflict = [string, string]

interface IConflict {
  conflicts: Conflict[]
}

class ConflictClass implements IConflict {
  conflicts = [['foo', 'bar']]
}

🙁 Actual behavior

It doesn't recognize the correct touple array definition at the class property initialization.

Error message:

Property 'conflicts' in type 'ConflictClass' is not assignable to the same property in base type 'IConflict'.
Type 'string[][]' is not assignable to type 'Conflict[]'.
Type 'string[]' is not assignable to type 'Conflict'.
Target requires 2 element(s) but source may have fewer.ts(2416)

🙂 Expected behavior

It does.

@MartinJohns
Copy link
Contributor

Duplicate of #10570.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Mar 26, 2021
@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