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
- doc: suggest named imports Same issue as https://github.com/isaacs/minimatch/issues/189 — committed to isaacs/rimraf by isaacs a year ago
- actually fix cjs require() default export Missed a step. https://github.com/isaacs/minimatch/issues/189#issuecomment-1399547966 — committed to isaacs/minimatch by isaacs a year ago
- fix error related to minimatch package upgrade - solution was suggested in https://github.com/isaacs/minimatch/issues/189 — committed to Ocelot-Social-Community/Ocelot-Social by mahula 9 months ago
This is the TS issue: https://github.com/microsoft/TypeScript/issues/50466
“Proper” (ugly) fix incoming.