Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript @类型/hapi\uuu hapi错误TS2314:泛型类型';监听器&x27;需要1个类型参数_Typescript_Types_Yarnpkg_Hapi - Fatal编程技术网

Typescript @类型/hapi\uuu hapi错误TS2314:泛型类型';监听器&x27;需要1个类型参数

Typescript @类型/hapi\uuu hapi错误TS2314:泛型类型';监听器&x27;需要1个类型参数,typescript,types,yarnpkg,hapi,Typescript,Types,Yarnpkg,Hapi,hapi的新版本,并在Typescript中使用版本“@hapi/hapi”:“^20.1.2”。当我添加包“@types/hapi\uu-hapi”:“^20.0.6时,@types/hapi\uu-hapi与其依赖项@types/hapi\uu-podium之间存在类型不匹配。我得到以下错误: node_modules/@types/hapi__hapi/index.d.ts:254:18 - error TS2430: Interface 'RequestEvents' incorrect

hapi的新版本,并在Typescript中使用版本“@hapi/hapi”:“^20.1.2”。当我添加包“@types/hapi\uu-hapi”:“^20.0.6时,@types/hapi\uu-hapi与其依赖项@types/hapi\uu-podium之间存在类型不匹配。我得到以下错误:

node_modules/@types/hapi__hapi/index.d.ts:254:18 - error TS2430: Interface 'RequestEvents' incorrectly extends interface 'Podium'.
  Types of property 'on' are incompatible.
    Type '{ (criteria: "peek", listener: PeekListener): void; (criteria: "finish" | "disconnect", listener: (data: undefined) => void): void; }' is not assignable to type '<Tcontext extends object = this>(criteria: string | CriteriaObject, listener: Listener<Tcontext>, context?: Tcontext) => this'.
      Types of parameters 'listener' and 'listener' are incompatible.
        Types of parameters 'tags' and 'encoding' are incompatible.
          Type 'string' is not assignable to type '{ [tag: string]: true; }'.

254 export interface RequestEvents extends Podium {
                     ~~~~~~~~~~~~~

node_modules/@types/hapi__hapi/index.d.ts:514:32 - error TS2709: Cannot use namespace 'Boom' as a type.

514     response: ResponseObject | Boom;
                                   ~~~~

node_modules/@types/hapi__hapi/index.d.ts:627:18 - error TS2430: Interface 'ResponseEvents' incorrectly extends interface 'Podium'.
  Types of property 'on' are incompatible.
    Type '{ (criteria: "peek", listener: PeekListener): void; (criteria: "finish", listener: (data: undefined) => void): void; }' is not assignable to type '<Tcontext extends object = this>(criteria: string | CriteriaObject, listener: Listener<Tcontext>, context?: Tcontext) => this'.
      Types of parameters 'listener' and 'listener' are incompatible.
        Types of parameters 'tags' and 'encoding' are incompatible.
          Type 'string' is not assignable to type '{ [tag: string]: true; }'.

627 export interface ResponseEvents extends Podium {
                     ~~~~~~~~~~~~~~

node_modules/@types/hapi__hapi/index.d.ts:2357:43 - error TS2314: Generic type 'Listener' requires 1 type argument(s).

2357     removeListener(criteria: K, listener: Podium.Listener): this;
                                               ~~~~~~~~~~~~~~~

node_modules/@types/hapi__hapi/index.d.ts:2375:18 - error TS2430: Interface 'ServerEvents' incorrectly extends interface 'Podium'.
  The types returned by 'on(...)' are incompatible between these types.
    Type 'void' is not assignable to type 'this'.
      'this' could be instantiated with an arbitrary type which could be unrelated to 'void'.

2375 export interface ServerEvents extends Podium {
                      ~~~~~~~~~~~~

node_modules/@types/hapi__hapi/index.d.ts:2441:44 - error TS2314: Generic type 'Listener' requires 1 type argument(s).

2441     removeListener(name: string, listener: Podium.Listener): Podium;
                                                ~~~~~~~~~~~~~~~

node_modules/@types/hapi__hapi/index.d.ts:4057:18 - error TS2709: Cannot use namespace 'Boom' as a type.

4057         (Error | Boom) |
                      ~~~~

node_modules/@types/hapi__inert/node_modules/@types/hapi__hapi/index.d.ts:260:18 - error TS2430: Interface 'RequestEvents' incorrectly extends interface 'Podium'.
  Types of property 'on' are incompatible.
    Type '{ (criteria: "peek", listener: PeekListener): void; (criteria: "finish" | "disconnect", listener: (data: undefined) => void): void; }' is not assignable to type '<Tcontext extends object = this>(criteria: string | CriteriaObject, listener: Listener<Tcontext>, context?: Tcontext) => this'.
      Types of parameters 'listener' and 'listener' are incompatible.
        Types of parameters 'tags' and 'encoding' are incompatible.
          Type 'string' is not assignable to type '{ [tag: string]: true; }'.

260 export interface RequestEvents extends Podium {
                     ~~~~~~~~~~~~~

node_modules/@types/hapi__inert/node_modules/@types/hapi__hapi/index.d.ts:633:18 - error TS2430: Interface 'ResponseEvents' incorrectly extends interface 'Podium'.
  Types of property 'on' are incompatible.
    Type '{ (criteria: "peek", listener: PeekListener): void; (criteria: "finish", listener: (data: undefined) => void): void; }' is not assignable to type '<Tcontext extends object = this>(criteria: string | CriteriaObject, listener: Listener<Tcontext>, context?: Tcontext) => this'.
      Types of parameters 'listener' and 'listener' are incompatible.
        Types of parameters 'tags' and 'encoding' are incompatible.
          Type 'string' is not assignable to type '{ [tag: string]: true; }'.

633 export interface ResponseEvents extends Podium {
                     ~~~~~~~~~~~~~~

node_modules/@types/hapi__inert/node_modules/@types/hapi__hapi/index.d.ts:2365:43 - error TS2314: Generic type 'Listener' requires 1 type argument(s).

2365     removeListener(criteria: K, listener: Podium.Listener): this;
                                               ~~~~~~~~~~~~~~~

node_modules/@types/hapi__inert/node_modules/@types/hapi__hapi/index.d.ts:2383:18 - error TS2430: Interface 'ServerEvents' incorrectly extends interface 'Podium'.
  The types returned by 'on(...)' are incompatible between these types.
    Type 'void' is not assignable to type 'this'.
      'this' could be instantiated with an arbitrary type which could be unrelated to 'void'.

2383 export interface ServerEvents extends Podium {
                      ~~~~~~~~~~~~

node_modules/@types/hapi__inert/node_modules/@types/hapi__hapi/index.d.ts:2449:44 - error TS2314: Generic type 'Listener' requires 1 type argument(s).

2449     removeListener(name: string, listener: Podium.Listener): Podium;
                                                ~~~~~~~~~~~~~~~

他们已经在看了,

...
  "dependencies": {
    "@hapi/hapi": "^20.1.2",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "nodemon": "^2.0.7",
    "ts-node-dev": "^1.1.6",
    "tslint": "^6.1.3",
    "typescript": "^4.2.4"
  },
  "devDependencies": {
    "@types/hapi__hapi": "^20.0.6"
  }
...