Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
marke-apexit opened this issue Jul 5, 2024 · 1 comment
Open

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

marke-apexit opened this issue Jul 5, 2024 · 1 comment

Comments

@marke-apexit
Copy link

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

@jwbth
Copy link

jwbth commented Aug 12, 2024

To maintainers: TypeScript 5 supports stage 3 decorator implementation without --experimentalDecorators, see https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#decorators. The cause of this issue is that typescript-memoize only supports the stage 2 implementation of decorators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants