Type CeramicClient is not assignable to type CeramicApi Error

Hello everyone! I’m new to Ceramic and was working on an application based on an older tutorial blog I found and I’ve run into an error I can’t seem to resolve. the Blog is a bit outdated, but I was able to resolve most of the errors as many where related to using ESM and a few references to older NPM packages. But the one I can’t seem to resolve is Type 'CeramicClient' is not assignable to type 'CeramicApi'.

For reference the blog I followed is here: How to build a simple notes app with IDX

and the specific line of code throwing the error is here: cermanic-test-app/idx.ts at 470542439d96ea2bf6951289f4b256ac85db7536 · jpvajda/cermanic-test-app · GitHub

any suggestions would be greatly appreciated it.

Hey there! If you import the CeramicApi type you should be able to typecast this like below

import { CeramicApi } from '@ceramicnetwork/common'
const idx = new IDX({ceramic as CeramicApi, aliases: definitions })
2 Likes

Usually that error indicates a mismatch in the package versions in use. Can you make sure you’re on all the most recent versions of all the Ceramic and ComposeDB packages, delete your package-lock.json file, and reinstall and rebuild and see if that helps?

1 Like

@stickykeys Thanks for the suggestion here, that approach is actually throwing a new set of typescript errors so it doesn’t seem to work in this case.

@spencer I deleted the package-lock.json file an ran npm install then npm outdated and here’s the output

npm outdated
Package                       Current    Wanted    Latest  Location                                  Depended by
@testing-library/user-event    13.5.0    13.5.0    14.4.3  node_modules/@testing-library/user-event  idx-demo-app
@types/jest                    27.5.2    27.5.2    29.2.5  node_modules/@types/jest                  idx-demo-app
@types/node                  16.18.11  16.18.11  18.11.18  node_modules/@types/node                  idx-demo-app
uint8arrays                     4.0.2     4.0.3     4.0.3  node_modules/uint8arrays                  idx-demo-app
web-vitals                      2.1.4     2.1.4     3.1.0  node_modules/web-vitals                   idx-demo-app

Can you please share your Node and NPM versions, and include the full error and stack trace you are seeing at compile time?

Also if you can share your package.json file too, that’d be helpful