ceramicnetwork / js-did

A simple interface to interact with DIDs that conform to the DID-provider interface.
Other
95 stars 28 forks source link

Type 'ResolverRegistry' is not assignable to type 'Resolver | ResolverRegistry | undefined'. #170

Open vaultec81 opened 11 months ago

vaultec81 commented 11 months ago

Description

Seems types are invalid between what's required by js-did and what's produced by key-did-resolver. I am not sure if this issue is only on my machine or not. I was able to bypass by doing as any to prevent the type checker for looking any further

Technical Information

test/util/get-test-ceramic-client.function.ts:9:25 - error TS2322: Type 'ResolverRegistry' is not assignable to type 'Resolver | ResolverRegistry | undefined'.
  Type 'ResolverRegistry' is missing the following properties from type 'Resolver': registry, cache, resolve

9   const did = new DID({ resolver: KeyResolver.getResolver() })

StackTrace Example:

import * as KeyResolver from 'key-did-resolver'
import { DID } from 'dids'

const did = new DID({ resolver: KeyResolver.getResolver() })

package.json

"key-did-resolver": "^3.0.0",
"dids": "^4.0.4"

Full usage https://github.com/spknetwork/spk-graph-client/blob/main/test/util/get-test-ceramic-client.function.ts

oed commented 11 months ago

I'm unable to reproduce the issue locally using the example in your post.

However, it looks like your repo is on an old version of key-did-resolver: https://github.com/spknetwork/spk-graph-client/blob/main/package.json#L44

vaultec81 commented 11 months ago

@oed I upgraded everything to latest on my local branch as shown above. I'll double check to make sure it installed correctly and any other conflict points.

oed commented 11 months ago

@vaultec81 I tried the example code snippet you provided in OP in a clean repo and it worked for me. So I suspect maybe you have multiple versions of some package installed perhaps?