node_modules/glob/dist/mjs/index"' has no exported member 'IOptions'. && Minipass type error

huangapple go评论53阅读模式
英文:

node_modules/glob/dist/mjs/index"' has no exported member 'IOptions'. && Minipass type error

问题

我正在尝试将glob从版本8.1.0升级到10.2.4(只要我有版本9.x.x或更高版本就可以)。@types/glob的版本是8.1.0。在运行npm run build时,出现以下错误:

PS > npm run build

> identity.service@1.0.0 build
> npm run compile && node infrastructure/build-api && node infrastructure/build-cf && npm run api-spec-check

> identity.service@1.0.0 compile
> tsc -p ./

infrastructure/copy-files.ts:15:27 - error TS2694: Namespace '"C:/Users/YashRaniga/Documents/dev/identity-service/node_modules/glob/dist/mjs/index"'没有导出成员'IOptions'。

15     let globOptions: glob.IOptions = {};
                             ~~~~~~~~

node_modules/glob/node_modules/minipass/index.d.ts:148:3 - error TS2416: 类型'Minipass<RType, WType, Events>'中的属性'on'无法分配给基类型'Stream'中的相同属性。
  类型'<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any) => this'无法分配给类型'(eventName: string | symbol, listener: (...args: any[]) => void) => this'。
    参数'type'和'eventName'的类型不兼容。
      类型'string | symbol'不能分配给类型'Events'的键。
        类型'symbol'不能分配给类型'Events'的键。
          类型'symbol'不能分配给类型'Events<RType>'的键。

148   on<Event extends keyof Events>(
      ~~

node_modules/glob/node_modules/minipass/index.d.ts:153:3 - error TS2416: 类型'Minipass<RType, WType, Events>'中的属性'once'无法分配给基类型'Stream'中的相同属性。
  类型'<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any) => this'无法分配给类型'(eventName: string | symbol, listener: (...args: any[]) => void) => this'。
    参数'type'和'eventName'的类型不兼容。
      类型'string | symbol'不能分配给类型'Events'的键。
        类型'symbol'不能分配给类型'Events'的键。

153   once<Event extends keyof Events>(
      ~~~~

node_modules/glob/node_modules/minipass/index.d.ts:158:3 - error TS2416: 类型'Minipass<RType, WType, Events>'中的属性'addListener'无法分配给基类型'Stream'中的相同属性。
  类型'<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any) => this'无法分配给类型'(eventName: string | symbol, listener: (...args: any[]) => void) => this'。
    参数'type'和'eventName'的类型不兼容。
      类型'string | symbol'不能分配给类型'Events'的键。
        类型'symbol'不能分配给类型'Events'的键。

158   addListener<Event extends keyof Events>(
      ~~~~~~~~~~~
        类型'symbol'不能分配给类型'Events'的键。

163   emit<Event extends keyof Events>(ev: Event, ...data: Events[Event]): boolean
      ~~~~

在2个文件中找到了5个错误。

错误  文件
     1  infrastructure/copy-files.ts:15
     4  node_modules/glob/node_modules/minipass/index.d.ts:148

经过多次查看Stack Overflow的帖子,没有一个有效。看到一个帖子中似乎不需要@types/glob,但移除它并没有解决问题。运行npm install minipass也没有修复minipass错误。

英文:

I am currently trying to upgrade glob from version 8.1.0 to 10.2.4 (as long as I have version 9.x.x or higher it's fine). @types/glob version is 8.1.0. When running npm run build, the following error comes:

PS &gt; npm run build

&gt; identity.service@1.0.0 build
&gt; npm run compile &amp;&amp; node infrastructure/build-api &amp;&amp; node infrastructure/build-cf &amp;&amp; npm run api-spec-check


&gt; identity.service@1.0.0 compile
&gt; tsc -p ./

infrastructure/copy-files.ts:15:27 - error TS2694: Namespace &#39;&quot;C:/Users/YashRaniga/Documents/dev/identity-service/node_modules/glob/dist/mjs/index&quot;&#39; has no exported member &#39;IOptions&#39;.

15     let globOptions: glob.IOptions = {};
                             ~~~~~~~~

node_modules/glob/node_modules/minipass/index.d.ts:148:3 - error TS2416: Property &#39;on&#39; in type &#39;Minipass&lt;RType, WType, Events&gt;&#39; is not assignable to the same property in base type &#39;Stream&#39;.
  Type &#39;&lt;Event extends keyof Events&gt;(ev: Event, handler: (...args: Events[Event]) =&gt; any) =&gt; this&#39; is not assignable to type &#39;(eventName: string | symbol, listener: (...args: any[]) =&gt; void) =&gt; this&#39;.
    Types of parameters &#39;ev&#39; and &#39;eventName&#39; are incompatible.
      Type &#39;string | symbol&#39; is not assignable to type &#39;keyof Events&#39;.
        Type &#39;symbol&#39; is not assignable to type &#39;keyof Events&#39;.
          Type &#39;symbol&#39; is not assignable to type &#39;keyof Events&lt;RType&gt;&#39;.

148   on&lt;Event extends keyof Events&gt;(
      ~~

node_modules/glob/node_modules/minipass/index.d.ts:153:3 - error TS2416: Property &#39;once&#39; in type &#39;Minipass&lt;RType, WType, Events&gt;&#39; is not assignable to the same property in base type &#39;Stream&#39;.
  Type &#39;&lt;Event extends keyof Events&gt;(ev: Event, handler: (...args: Events[Event]) =&gt; any) =&gt; this&#39; is not assignable to type &#39;(eventName: string | symbol, listener: (...args: any[]) =&gt; void) =&gt; this&#39;.
    Types of parameters &#39;ev&#39; and &#39;eventName&#39; are incompatible.
      Type &#39;string | symbol&#39; is not assignable to type &#39;keyof Events&#39;.
        Type &#39;symbol&#39; is not assignable to type &#39;keyof Events&#39;.

153   once&lt;Event extends keyof Events&gt;(
      ~~~~

node_modules/glob/node_modules/minipass/index.d.ts:158:3 - error TS2416: Property &#39;addListener&#39; in type &#39;Minipass&lt;RType, WType, Events&gt;&#39; is not assignable to the same property in base type &#39;Stream&#39;.
  Type &#39;&lt;Event extends keyof Events&gt;(ev: Event, handler: (...args: Events[Event]) =&gt; any) =&gt; this&#39; is not assignable to type &#39;(eventName: string | symbol, listener: (...args: any[]) =&gt; void) =&gt; this&#39;.
    Types of parameters &#39;ev&#39; and &#39;eventName&#39; are incompatible.
      Type &#39;string | symbol&#39; is not assignable to type &#39;keyof Events&#39;.
        Type &#39;symbol&#39; is not assignable to type &#39;keyof Events&#39;.

158   addListener&lt;Event extends keyof Events&gt;(
      ~~~~~~~~~~~
        Type &#39;symbol&#39; is not assignable to type &#39;keyof Events&#39;.

163   emit&lt;Event extends keyof Events&gt;(ev: Event, ...data: Events[Event]): boolean
      ~~~~


Found 5 errors in 2 files.

Errors  Files
     1  infrastructure/copy-files.ts:15
     4  node_modules/glob/node_modules/minipass/index.d.ts:148

Gone through multiple stack overflow threads, none of them have worked. Saw one thread where apparently @types/glob isn't required but removing that didn't work. Running npm install minipass also didn't fix the minipass errors

答案1

得分: 0

glob.IOptions不再存在。它只是从glob包导入的GlobOptions

最新的minipass版本已经修复了minipass错误。

英文:

glob.IOptions is no longer a thing. It's just GlobOptions, imported from the glob package.

The minipass error was fixed on the latest minipass version.

huangapple
  • 本文由 发表于 2023年5月17日 06:58:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76267582.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定