<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨 Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common "Bugs" That Aren't Bugs section! Please help us by doing the following steps before logging an issue: * Search: https://github.com/Microsoft/TypeScript/search?type=Issues * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ Please fill in the *entire* template below. --> <!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. --> **TypeScript Version:** 3.2.0-dev.201xxxxx <!-- Search terms you tried before logging this (so others can find this issue more easily) --> **Search Terms:** type narrowing tuple type inference tuple **Code** ```ts const x: [number, number] = [0, 0]; if (x[0] === 0) { x[0] = -1; } ``` **Expected behavior:** The code should compile. The above code does compile with `typescript@3.0.3`. **Actual behavior:** error TS2322: Type '-1' is not assignable to type '0'. **Playground Link:** http://www.typescriptlang.org/play/ **Related Issues:** <!-- Did you find other bugs that looked similar? -->
Activity
ahejlsberg commentedon Oct 5, 2018
Duplicate of #27412.
Elt access assignment uses declared, not narrowed type
Elt access assignment uses declared, not narrowed type (#27574)