Closed tleveque23 closed 6 years ago
I just created a very basic application that replicate the bug: https://github.com/tleveque23/cacheablebug
Just try to run ng serve with it.
Thanks for report @tleveque23. The cacheable decorator is still using RxJs 5.5. Upgrading that to 6.0.0 will fix it. Gonna fix this soon!
@tleveque23 I published 1.0.2 which includes a fix for your issue + bumping up RxJs version to 6.2.0. Hope that resolved your issue!
Hi, @angelnikolov
experiencing same problem now
"rxjs": "6.5.4"
"ngx-cacheable": "1.4.1"
const buster$ = new Subject<void>()
@Cacheable({ cacheBusterObserver: buster$.asObservable() })
private get data(): string {return 'somestring'}
error TS2345: Argument of type 'TypedPropertyDescriptor<string>' is not assignable to parameter of type 'TypedPropertyDescriptor<ICacheable<Observable<any>>>'.
Type 'string' is not assignable to type 'ICacheable<Observable<any>>'.
The method needs to return an Observable. :)
Oh no! :) Maybe its better to add return type to methods in documentation to prevent further mistakes like mine?
Also is it going to be implemented for scalar values in the future?
P.S. thank you for the fas answer!
Yes, adding return types makes sense. Will add to my list. :) About scalar values, I haven't thought about that, but we already have decorators for that like memo. https://www.npmjs.com/package/memo-decorator If there's demand I can add it in, but I can't say when.
As soon as I try to use the option "cacheBusterObserver" in the @Cacheable() decorator, I get a compilation error:
I have a constant declared with the right name (const productNotifier = new Subject();) in my file.
Note: It is working fine if I just use the plain @Cacheable() without any options. Note #2: If when it is working fine without the option (using ng serve), I add the option and the Subject and save, I see the compilation error but it says "Compiled successfully" and the code actually work fine! But if I stop ng serve and try to start it again, then it fail....
I am using: angular 5.2.10 rxjs 5.5.10 zone 0.8.26 typescript 2.6.2