Dexie.js: import 'dexie-observable': Cannot augment module 'Dexie' with value exports because it resolves to a non-module entity.

Created on 10 May 2019  路  15Comments  路  Source: dfahlander/Dexie.js

I'm trying to include dexie-observable, however the TS transpiler seems to have an issue with that:

ERROR in node_modules/dexie-observable/dist/dexie-observable.d.ts(13,15): error TS2649: Cannot augment module 'Dexie' with value exports because it resolves to a non-module entity.
node_modules/dexie-observable/dist/dexie-observable.d.ts(17,29): error TS2694: Namespace '"@paperwork/web/node_modules/dexie/dist/dexie".Dexie' has no exported member 'Observable'.
node_modules/dexie-observable/dist/dexie-observable.d.ts(34,40): error TS2694: Namespace '"@paperwork/web/node_modules/dexie/dist/dexie".Dexie' has no exported member 'Observable'.
node_modules/dexie-observable/dist/dexie-observable.d.ts(37,39): error TS2694: Namespace '"@paperwork/web/node_modules/dexie/dist/dexie".Dexie' has no exported member 'Observable'.
node_modules/dexie-observable/dist/dexie-observable.d.ts(46,60): error TS2694: Namespace '"@paperwork/web/node_modules/dexie/dist/dexie".Dexie' has no exported member 'Observable'.
node_modules/dexie-observable/dist/dexie-observable.d.ts(99,56): error TS2694: Namespace '"@paperwork/web/node_modules/dexie/dist/dexie".Dexie' has no exported member 'DexieEventSet'.
node_modules/dexie-observable/dist/dexie-observable.d.ts(120,22): error TS2339: Property 'Observable' does not exist on type 'DexieConstructor'.
src/app/app.component.ts(51,11): error TS2345: Argument of type '"changes"' is not assignable to parameter of type '"versionchange"'.

Also, this time it doesn't seem to be caching related. :)

backlog bug

Most helpful comment

For anyone looking for a dirty fix while waiting for official typings, the simplest solution for us was to just remove the typings in the build pipeline to get rid of the build errors. Obviously this isn't a fix, but I just needed it to compile in a build pipeline.

- npm install
- rm node_modules/dexie-syncable/dist/dexie-syncable.d.ts
- rm node_modules/dexie-observable/api.d.ts
- rm node_modules/dexie-observable/dist/dexie-observable.d.ts
- ng build

The only other issue was Dexie.Syncable was therefor not a valid member. Fixed by (Dexie as any).Syncable

Not proud of these as fixes, but it works temporarily for someone with little type extension experience.

Good luck

All 15 comments

What versions of dexie and dexie-observable are you using?

    "dexie": "^3.0.0-alpha.8",
    "dexie-observable": "^1.0.0-beta.5",
    "dexie-syncable": "^1.0.0-beta.4",

I looked for @next versions of observable/syncable but couldn't find any.

Ok, are you having the same issue with [email protected] or could this be an issue with typings for dexie-observable with dexie@next?

@dfahlander thanks for asking! Just tried this, it looks like this package configuration works just fine:

    "dexie": "^2.0.4",
    "dexie-observable": "^1.0.0-beta.5",
    "dexie-syncable": "^1.0.0-beta.4",

Any way for me to get it working with next as well? :-)

I see, I think the typings for the addons are not compatible with dexie@3 and if I remember correctly, we might need to release new versions of dexie-observable that target dexie@3 - not for the runtime but due to the difference in typings.

Keeping this as an open issue to be fixed. I suppose we will need 3.0.0-versions of the addons just for this sake.

@dfahlander Can I ask if there are any updates regarding this issue? Also, can I ask for your opinion regarding ways to listen for on 'changes' using dexie 3.x?

Thank you.

Not sure. I have merged a contributor's PR that should fix typings in dexie-observable but I haven't checked if that PR did resolve this specific issue. Please help verify that with the latest npm releases of dexie-observable and [email protected].

Dexie3 should backward compatible runtime-wise with the addons so listening for changes should be the same.

Hello @dfahlander ,
The same problem occurs with the latest releases:

 "dexie": "^3.0.0-rc.6"
 "dexie-observable": "^1.0.0-beta.6"

The issue is with the typings:

No overload matches this call.
  The last overload gave the following error.
    Argument of type '"changes"' is not assignable to parameter of type '"versionchange"'.ts(2769)
dexie.d.ts(446, 3): The last overload is declared here.

I too have the same issue with versions :

        "dexie": "^3.0.0-rc.7",
        "dexie-observable": "^1.0.0-beta.6",

Both dexie-observable and dexie-syncable are affected. I tried to fix the type definitions but afaik thats not possible in the way how dexie@3 is typed(but I could be wrong here).

My temporary solution was to modify the paths for both addons within the tsconfig file to resolve to striped defintion files. Now I can use dexie@3 with both addons but lose many direct addon typings

@donmahallem Any chance you could share your solution for this issue? I don't quite understand how you've accomplished it...

For anyone looking for a dirty fix while waiting for official typings, the simplest solution for us was to just remove the typings in the build pipeline to get rid of the build errors. Obviously this isn't a fix, but I just needed it to compile in a build pipeline.

- npm install
- rm node_modules/dexie-syncable/dist/dexie-syncable.d.ts
- rm node_modules/dexie-observable/api.d.ts
- rm node_modules/dexie-observable/dist/dexie-observable.d.ts
- ng build

The only other issue was Dexie.Syncable was therefor not a valid member. Fixed by (Dexie as any).Syncable

Not proud of these as fixes, but it works temporarily for someone with little type extension experience.

Good luck

image

error still occurred on 3.0.1

Working on this. Duplicate of #1048

I've published new versions of dexie-observable and dexie-syncable on npm that should be type-wise compatible with Dexie 3.0. Any feedback on these would be much apprechiated:

npm i dexie-observable@next dexie-syncable@next

Should give you versions 3.0.0-beta.9 on both of them.

Was this page helpful?
0 / 5 - 0 ratings