openwallet-foundation / credo-ts

Typescript framework for building decentralized identity and verifiable credential solutions
https://credo.js.org
Apache License 2.0
273 stars 200 forks source link

Types mismatch for `credentials` property on `Agent` #1187

Closed baristikir closed 1 year ago

baristikir commented 1 year ago

Overview

After upgrading to "@aries-framework/core": "^0.3.1" the types on Agents credentials are resulting into any. Looking at the migration docs from 0.2.X to 0.3.X I couldn't find any changes regarding to credentials.

Reproduce

const agent = new Agent({ config, dependencies: agentDependencies })
await agent.credentials // typed as `any`
TimoGlastra commented 1 year ago

That's definitely a bug, thanks for reporting @baristikir!

I could reproduce it locally. One workaround you can use for now is adding an empty modules key to the agent constructor, that seemed to resolve the issue. I'll dig into it more, but for now that should do the trick:

const agent = new Agent({
  dependencies: agentDependencies,
  config: {
    label: 'hello'
  },
  modules: {}
})

agent.credentials // correctly typed with {} for modules
TimoGlastra commented 1 year ago

I've created https://github.com/hyperledger/aries-framework-javascript/pull/1188 to fix the issue. We'll try to get this into a 0.3.2 release ASAP