Skip to content

Error occurred in typescript 4.7 #3

@ChoSeoHwan

Description

@ChoSeoHwan

I want to use this library,
but an error occurred when using it and I can't use it.

Environment

  • node js : v16.13.0
  • typescript : 4.7.4

My Test Code

import { Enum, EnumType } from 'ts-jenum';

@Enum<TestEnum>('code')
export class TestEnum extends EnumType<TestEnum>() {
    static ONE = new TestEnum(1);
    static TWO = new TestEnum(2);
    static THREE = new TestEnum(3);
    static FOUR = new TestEnum(4);

    private constructor(readonly code: number) {
        super();
    }
}

Error message

    static ONE = new TestEnum(1);                                                                                                          
                 ^                                                                                                                         
TypeError: undefined is not a constructor

Reference link

https://stackoverflow.com/questions/48134909/typescript-class-decorator-can-not-access-static-value-if-decorator-return-as-hi

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