馃攷 Search Terms
TS1518, RegExp v flag, MayContainStrings, negated character class, ClassUnion, operand order, q{}
馃晽 Version & Regression Information
Occurs in every version tested: 7.0.2 and 7.1.0-dev.20260804.1 (nightly). I searched open and closed issues.
馃捇 Code
const a = /[^\q{xy}b]/v; // TS1518
const b = /[^b\q{xy}]/v; // no error
馃檨 Actual behavior
TS1518 only considers the first union operand. The second pattern is accepted but is invalid JavaScript.
馃檪 Expected behavior
Both patterns report TS1518: MayContainStrings is true when any union operand may match a string.
馃攷 Search Terms
TS1518,RegExp v flag,MayContainStrings,negated character class,ClassUnion,operand order,q{}馃晽 Version & Regression Information
Occurs in every version tested: 7.0.2 and
7.1.0-dev.20260804.1(nightly). I searched open and closed issues.馃捇 Code
馃檨 Actual behavior
TS1518 only considers the first union operand. The second pattern is accepted but is invalid JavaScript.
馃檪 Expected behavior
Both patterns report TS1518:
MayContainStringsis true when any union operand may match a string.