• Error
  • Reported by the lexer and parser

TS1500

Duplicate regular expression flag.

A regular expression literal repeats a flag, like `/a/gg`. Remove the duplicate.

What it means

Each flag can appear once after a regular expression literal.

Example

index.ts
export const re = /abc/gig;
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(1,26): error TS1500: Duplicate regular expression flag.

Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.

How to fix

  • Remove the repeated letter.