minimatch: ESM Import Failing - v6.0.0

minimatch - 6.0.0 typescript - 4.9.4 node - 16.17.0

Error:

src/structure/spec_model/module/Module.struct.ts:218:59 - error TS2349: This expression is not callable.
  Type 'typeof import("F:/Project/node_modules/minimatch/dist/cjs/index")' has no call signatures.

218         return this.untrackedFilePatterns.find(pattern => minimatch(pathRelativeToContainer, pattern))

Usage:

import minimatch from 'minimatch'

protected isFileUntracked(pathRelativeToContainer: string): string | undefined {
    return this.untrackedFilePatterns.find(pattern => minimatch(pathRelativeToContainer, pattern))
}

tsconfig

{
  "compilerOptions": {
    "target": "ES2021",
    "module": "Node16",
    "lib": ["ES2021"],
    "sourceMap": true,
    "outDir": "dist",
    "moduleResolution": "Node16",
    "esModuleInterop": true
  }
}

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (10 by maintainers)

Commits related to this issue

Most upvoted comments

This is the TS issue: https://github.com/microsoft/TypeScript/issues/50466

“Proper” (ugly) fix incoming.