Skip to content

Providing a value of type any should cause type error but doesn't #46955

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
schickling opened this issue Nov 30, 2021 · 1 comment
Closed

Providing a value of type any should cause type error but doesn't #46955

schickling opened this issue Nov 30, 2021 · 1 comment

Comments

@schickling
Copy link

πŸ”Ž Search Terms

tuple, type check, any,

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

type Fields = [fieldKey: string, fieldValue: any][]

const x: any = null

// should fail but doesn't
const f: Fields = ['some str', x]

// fails correctly
const f2: Fields = ['some str', null]

// correct
const f3: Fields = [['some str', x]]

πŸ™ Actual behavior

const x: any = null

// should fail but doesn't
const f: Fields = ['some str', x]

πŸ™‚ Expected behavior

Should raise a type error

@MartinJohns
Copy link
Contributor

Duplicate of #19541. Used search terms: array any in:title

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants