vlio20/utils-decorators

please add code samples

born2net opened this issue · 10 comments

please add code samples

@born2net what tyoe of code samples? Just examples of how to use the decorator?

for example @memoizeAsync code snippet for usage will be helpful.
thanks!

I will add examples in the Readme file in the near future. Meanwhile I suggest you to take examlles from my blog post about this specific decorator: https://link.medium.com/AfVimxI1Tab

Let me know if it is helpful.

or for example @retry({retries: 1, delay: 1}) is erroring on

Error:(179, 5) TS1241: Unable to resolve signature of method decorator when called as an expression.
  Type 'TypedPropertyDescriptor<AsyncMethod<any>>' is not assignable to type 'TypedPropertyDescriptor<(e: any) => boolean>'.
    Type 'AsyncMethod<any>' is not assignable to type '(e: any) => boolean'.
      Type 'Promise<any>' is not assignable to type 'boolean'.

so sample snippets will be helpful.
tx

great will check blog

@born2net can you show the full example of the retry decorator?

Are you sure that this method returning a promise in all scenarios?

oh... didn't realize need to return a Promise. Ok I will fix no worries, thus a snippet code samples would be helpful as I could see it in the demo. tx again, Sean.