Typescript typing

53 views Asked by At

I'm trying to initialise REST server of Aries agent described here:

import { startServer } from '@aries-framework/rest'
import { Agent } from '@aries-framework/core'
import { agentDependencies } from '@aries-framework/node'

// The startServer function requires an initialized agent and a port.
// An example of how to setup an agent is located in the `samples` directory.
const run = async () => {
  const agentConfig: InitConfig = {
    label: 'demo-agent-acme',
    walletConfig: {
      id: 'mainAcme',
      key: 'demoagentacme0000000000000000000',
    },
    autoAcceptConnections: true,
    endpoints: ['http://localhost:3002'],
    logger: new ConsoleLogger(LogLevel.info),
  }

  // A new instance of an agent is created here
  const agent = new Agent({config: agentConfig, dependencies: agentDependencies})
  await startServer(agent, { port: 3000 })
}

// A Swagger (OpenAPI) definition is exposed on http://localhost:3000/docs
run()

but getting this error:

Argument of type 'Agent<any>' is not assignable to parameter of type 'Agent'.
  Type 'Agent<any>' is missing the following properties from type 'Agent': walletService, routingService, questionAnswer, actionMenu, registerDependenciests(2345)

I'm not sure how to fix it.

1

There are 1 answers

0
Miroslav Petrovic On

it seems that rest is using "@aries-framework/core": "^0.2.5" and I used code init from "@aries-framework/core": "^0.3.3", docs seems to be outdated...