node.js - 'node_modules/minimatch/dist/cjs/index' δεν έχει εξαγόμενο μέλος 'IOptions'


Έχω ένα έργο TypeScript για να τρέξει σε μια λειτουργία Firebase.

Εδώ είναι το tsconfig.json μου

{
  "compilerOptions": {
    "lib": ["es2017"],
    "module": "commonjs",
    "noImplicitReturns": true,
    "outDir": "dist",
    "sourceMap": true,
    "target": "es2017",
    "esModuleInterop": true,
    "strict": true
  },
  "include": ["src"],
  "exclude": ["dist", "node_modules"]
}

Όταν κάνω compile (npm run build, το οποίο τρέχει tsc)

Έλαβα το σφάλμα

node_modules/@types/glob/index.d.ts:29:42 - σφάλμα TS2694: Το namespace ''"/opt/workspace/personal/kioskify-backend/functions/node_modules/minimatch/dist/cjs/index"'' δεν έχει εξαγόμενο μέλος 'IOptions'.

29 διεπαφή IOptions επεκτείνει minimatch.IOptions {

ΕΠΙΣΗΜΑΝΣΗ: Το σφάλμα εμφανίζεται σε άλλα modules. Πλήρης έξοδος:

npm run build

> build
> npm run lint && tsc


> lint
> eslint --fix .

node_modules/@types/glob/index.d.ts:29:42 - error TS2694: Namespace '"/opt/workspace/personal/kioskify-backend/functions/node_modules/minimatch/dist/cjs/index"' has no exported member 'IOptions'.

29     interface IOptions extends minimatch.IOptions {
                                            ~~~~~~~~

node_modules/@types/glob/index.d.ts:75:30 - error TS2724: '"/opt/workspace/personal/kioskify-backend/functions/node_modules/minimatch/dist/cjs/index"' has no exported member named 'IMinimatch'. Did you mean 'Minimatch'?

75         minimatch: minimatch.IMinimatch;
                                ~~~~~~~~~~

node_modules/@types/rimraf/index.d.ts:33:21 - error TS2694: Namespace '"/opt/workspace/personal/kioskify-backend/functions/node_modules/glob/dist/mjs/index"' has no exported member 'IOptions'.

33         glob?: glob.IOptions | false | undefined;
                       ~~~~~~~~


Found 3 errors in 2 files.

Errors  Files
     2  node_modules/@types/glob/index.d.ts:29
     1  node_modules/@types/rimraf/index.d.ts:33

Και άλλα παρόμοια λάθη, τι μπορεί να είναι;

Απάντηση #1

Αναβαθμίστε τα rimraf, glob και minimatch στην τελευταία έκδοση. Αφαιρέστε τα πακέτα @types και για τα τρία. Στη συνέχεια θα λειτουργήσει σωστά.

Αυτά τα τρία είναι όλα γραμμένα σε ts τώρα, τα πακέτα @types προκαλούν το πρόβλημα.

Πηγή: Έγραψα και τα τρία αυτά.