17

I reckon they published some breaking changes, this is the error message that I get:

Property 'provideStore' does not exist on type 'typeof StoreModule'.

I googled this error-message, but did not find anything. Nevertheless I guess there have been API-Updates that I am not aware of.

Can anybody point me in the right direction?

1 Answer 正确答案

49

Solved it:

https://github.com/ngrx/store/issues/349

yes, it was deprecated, use "forRoot" instead

The method "provideStore" has been renamed to "forRoot", so that one better understands what this method does.

是的,它被弃用了,改用“forRoot”

方法“providestore”已重命名为“forRoot”,以便更好地理解该方法的作用。

来自  https://stackoverflow.com/questions/45412148/property-providestore-does-not-exist-on-type-typeof-storemodule


provideStore was deprecated? #349

 Closed
NiNJAD3vel0per opened this issue on 8 Mar 2017 · 2 comments

Comments

@NiNJAD3vel0per

commented on 8 Mar 2017  

I was looking for provideStore source code here to check the logic inside.. I couldn't
Instead, I found StoreModule.forRoot. I am not sure whether or not the method was deprecated from StoreModule because still so many blogs and tutorials and even examples(including offical ngrx book example too)are using provideStore() out there. Looks definitely need to update the document.(still no mention about this situation).
Also, I am interested in whether this project is almost stopped or not because the last update release was Sep. 2016.

@sebelga

Hum.... I don't know if you have the same as me, but for me in realease 2.1.1 it says:

BREAKING CHANGE: users should import {StoreModule, Store} from '@ngrx/store' and provide the store as follows:

import {StoreModule, Store} from '@ngrx/store'
import {NgModule} from '@angular/core'
import {BrowserModule} from '@angular/platform-browser'

@NgModule({
  imports: [
    BrowserModule,
    StoreModule.provideStore(reducer, initialState)
  ]
})

So it says to use provideStore... not that it is deprecated... ?? I am also following the official app that does use provideStore... Where can we find the correct way to provide the store?

@brandonroberts
Member

commented on 10 Mar 2017  

In the current release, the above usage is the correct way to use provideStore. In the next major release(V4) StoreModule.forRoot will be the correct way to provide store.

来自    https://github.com/ngrx/store/issues/349