Skip to content

any in array prevents type checking rest of array #38870

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
danielzgtg opened this issue Jun 1, 2020 · 1 comment
Closed

any in array prevents type checking rest of array #38870

danielzgtg opened this issue Jun 1, 2020 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@danielzgtg
Copy link

TypeScript Version: 3.9.3

Search Terms: "any array", "any list", "any prevents"

Code

// Works properly
let x: number = 123;
let y: number[] = [
        123,
        x,
        true,
];
// Doesn't work properly
let x: any = 123;
let y: number[] = [
        123,
        x,
        true,
];

Expected behavior: For both code snippets to result in the same compile error.

Actual behavior: The second snippet compiles without any error. This is unsound.

Playground Link: First Second

Related Issues: No

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Jun 2, 2020
@RyanCavanaugh
Copy link
Member

Duplicate #19541

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