grunt-ts: Warning: pattern.indexOf is not a function Use --force to continue.

Trying to run the ts command causes error:

Warning: pattern.indexOf is not a function Use --force to continue.

I tried to debug, but could not find the cause.

grunt-cli v0.1.13 grunt v0.4.5 typescript v1.7.3

Tried all grunt-ts versions until 4.2.0 which worked without issues.

Gruntfile.js configuration:

   ts: {
            development: {
                src: ['src/ts/**/*.ts'],
                outDir: 'src/js',
                options: {
                    module: 'amd',
                    target: 'es5',
                    sourceMap: true,
                    declaration: false,
                    noImplicitAny: false,
                    comments: true
                }
            }
    }

Maybe there’s something I’m missing blindly, but could not find it nor all the results Googling the same error just related mostly to grunt “files” needing to be array of objects instead of object.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

I suspect it’s because you’re using watch as a target. watch is one of the options we use for grunt-ts that gets passed along to Grunt. https://github.com/TypeStrong/grunt-ts#watch So Grunt is trying to call indexOf on the object.

Perhaps you could rename it to w or watched or live or something?

@nycdotnet 8.1.3 8.1.2 7.0.0

  • 4.5.0 (Currently using 64-bit executable)

yep, in my package.json: "grunt-ts": "^5.5.1"

Is there any stack trace? 🌹