Skip to content

typescript-memoize doesn't work for class methods  #59

@marke-apexit

Description

@marke-apexit

Although I can use the @Memoize() decorator with normal functions, I get an error when using the decorator on class methods.

import {Memoize} from 'typescript-memoize';

class Foo {
    @Memoize()
    bar(s: string) : string {
        return s;
    }
}
  node_modules/typescript-memoize/dist/memoize-decorator.d.ts:6:122
    6 export declare function Memoize(args?: MemoizeArgs | MemoizeArgs['hashFunction']): (target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor<any>) => void;                                                
                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    An argument for 'descriptor' was not provided.

TypeScript Version 5.5.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions