zoomsphere / ngx-store

Angular decorators to automagically keep variables in HTML5 LocalStorage, SessionStorage, cookies; injectable services for managing and listening to data changes and a bit more.
https://www.npmjs.com/package/ngx-store
ISC License
167 stars 41 forks source link

Property 'composedPath' is missing in type 'NgxStorageEvent'. on Angular 7 #66

Closed beleta closed 5 years ago

beleta commented 6 years ago

I get this error when using Angular 7:

ERROR in node_modules/ngx-store/src/utility/storage/storage-event.d.ts(1,22): error TS2420: Class 'NgxStorageEvent' incorrectly implements interface
'StorageEvent'.
  Property 'composedPath' is missing in type 'NgxStorageEvent'.
jan-moxter commented 6 years ago

Just wanted to report the same issue. can confirm it and that the solution works for me

jonathanwoahn commented 6 years ago

Having the same issue, would love to see the commit deployed ASAP

mtraynham commented 6 years ago

@beleta can you make a PR for your commit?

beleta commented 6 years ago

@beleta can you make a PR for your commit?

Done.

lixiaoyu0575 commented 6 years ago

having the same issue

shariquesears commented 6 years ago

@beleta can you make a PR for your commit?

Done.

When will this PR would be merged? I am kind of stuck while transition to Angular7

HarelM commented 6 years ago

Same here...

moses-kabungo commented 6 years ago

I had the same problem. I decided to do a minor hack using the post-install script.

package.json

"scripts": {
   "postinstall": "bash ./fix-ngx-store.sh"
}

fix-ngx-store.sh

#!/bin/bash

echo '***Temporarily fix the ngx store. Until the PR is merged.'

sed -i '$ icomposedPath(): EventTarget[];' node_modules/ngx-store/src/utility/storage/storage-event.d.ts
sed -i '/oldValue?: any;/c\oldValue: any' node_modules/ngx-store/src/utility/storage/storage-event.d.ts
mtraynham commented 6 years ago

Might be worth just forking and pushing the full build to Github temporarily, then using a npm reference to the Github branch.

mtraynham commented 6 years ago

I've upgraded the project to Angular 7 in my own fork. This includes the change from @beleta, as well as some other changes to fix the build (e.g no longer relevant properties of NgxStorageEvent). You can use the following as a dependency if you wish to use this:

   "ngx-store": "mtraynham/ngx-store#angular_7_build"

Relevant changes are on the angular_7 branch. The angular_7_build branch, just publishes the dist directory Github so it can be downloaded by NPM (or Yarn).

One thing to note, I had to lock "@types/node" to 10.11.6, to prevent a different issue with ts-debug, also owned by our friend @DanielKucal. Hopefully he pops up soon enough.

For now, I'll leave the fork up until he get's back, or feel free to fork mine and use your own Github namespace ("ngx-build": "<your-username>/ngx-store#angular_7_build").

aleperfetti81 commented 6 years ago

Good afternoon,

ng serve throw following error after upgrading to angular 7:

ERROR in node_modules/ngx-store/src/utility/storage/storage-event.d.ts(1,22): error TS2420: Class 'NgxStorageEvent' incorrectly implements interface 'StorageEvent'.
  Property 'composedPath' is missing in type 'NgxStorageEvent'.

How to resolve?

Thank you very much.

mtraynham commented 6 years ago

@aleperfetti81 , see https://github.com/zoomsphere/ngx-store/issues/66#issuecomment-434385463

aleperfetti81 commented 6 years ago

@aleperfetti81 , see #66 (comment)

Thanks for the response. Can you please tell me where should i insert that dependency? I've been using angular recently and I'm a bit inexperienced about these things

mtraynham commented 6 years ago

Yeah in your package.json file just replace:

"dependencies": {
   "ngx-store": "^2.0.0",
}

with:

"dependencies": {
   "ngx-store": "mtraynham/ngx-store#angular_7_build",
}

or fork my ngx-store repo to your own repo, and reference your fork instead:

"dependencies": {
   "ngx-store": "aleperfetti81/ngx-store#angular_7_build",
}

You shouldn't need to change anything else, it's basically just upgrading the dependency.

aleperfetti81 commented 6 years ago

"ngx-store": "mtraynham/ngx-store#angular_7_build"

Thank you very much. You saved my day @mtraynham

Olindholm commented 5 years ago

@mtraynham Hey, I'm also a bit new to npm and ngx. But I followed your instructions and it works nice. However everytime I install a new package with npm, for some reason ngx-store is removed, so I have to call npm i ngx-store --save again or I'll just get stuck with a bunch of errors saying ngx-store can't be resolved. Did I do something wrong or?

DanielKucal commented 5 years ago

A new version has been released, mainly thanks to @timn. npm i ngx-store@latest --save should fix your problems. Please let me know if it does not.

timn commented 5 years ago

Thanks! Doesn't show up in Github, yet. Forgot to push the tag?