* 'in' should not operate on primitive types * accept baselines of failing tests * review * update error message * check if constraint of right type is assignable to a non primitive or instantiable non primitive * do not throw errors where narrowing is impossible * accept baselines * fix test case failures * Add more accurate comment discussion and document failing edge case in test * Update baselines Co-authored-by: Jonas Hübotter <jonas.huebotter@gmail.com>
18 lines
460 B
Plaintext
18 lines
460 B
Plaintext
tests/cases/compiler/inOperator.ts(7,15): error TS2361: The right-hand side of an 'in' expression must not be a primitive.
|
|
|
|
|
|
==== tests/cases/compiler/inOperator.ts (1 errors) ====
|
|
var a=[];
|
|
|
|
for (var x in a) {}
|
|
|
|
if (3 in a) {}
|
|
|
|
var b = '' in 0;
|
|
~
|
|
!!! error TS2361: The right-hand side of an 'in' expression must not be a primitive.
|
|
|
|
var c: any;
|
|
var y: number;
|
|
if (y in c) { }
|
|
|