angelnikolov / ts-cacheable

Observable/Promise Cache Decorator
https://npmjs.com/package/ts-cacheable
ISC License
340 stars 42 forks source link

TypeError: rxjs_1.of is not a function #10

Closed zymr-keshav closed 6 years ago

zymr-keshav commented 6 years ago

followings are the version details

   "ngx-cacheable": "^1.0.6",
   "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.3.4",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "rxjs": "^5.1.0",

I have added @Cacheable decorator in user.service.ts file as below

import { Cacheable } from 'ngx-cacheable';
...

@Cacheable()
    getUserDetail(): Observable<any> {
        return this.httpClient
            .get<UserResponse>(`/user/profile`, { withCredentials: true })
            .map((res) => res.item);
    }

bit it throw errors

ERROR TypeError: rxjs_1.of is not a function at UserService.propertyDescriptor.value [as getUserDetail] (cacheable.decorator.js:60) at ProfileComponent.getUserDetail (profile.component.ts:73) at ProfileComponent.ngAfterViewInit (profile.component.ts:60) at callProviderLifecycles (core.es5.js:11176) at callElementProvidersLifecycles (core.es5.js:11147) at callLifecycleHooksChildrenFirst (core.es5.js:11131) at checkAndUpdateView (core.es5.js:12259) at callViewAction (core.es5.js:12599) at execEmbeddedViewsAction (core.es5.js:12557) at checkAndUpdateView (core.es5.js:12252)

What is the reason and how to solve it?

ThibaudAV commented 6 years ago

Maybe the version of rxjs 🤔 @Cacheable need 6.2.0 and you use 5.1.1

itaiRoded2 commented 5 years ago

I have the same issue image

itaiRoded2 commented 5 years ago

Sorry just saw the rxjs version. Yeh I am using "rxjs": "^5.5.2", @Cacheable need 6.2.0 and you use 5.1.1 ( I would put this in the project homepage) :)

Thanks & all the best!

angelnikolov commented 5 years ago

:) you too