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

Date type changed to Object type, when run from src, while run from build works. #567

Closed
An1mus opened this issue Apr 12, 2018 · 1 comment

Comments

@An1mus
Copy link

An1mus commented Apr 12, 2018

Hello.
I've created a decorator for DateTime field, which type is Date.
TS(src) example:

@DateTimeField()
someField: Date;

JS(build) example:

__decorate([
      date_time_field_1.DateTimeField(),
      __metadata("design:type", Date)
]

When running test from .ts file, Reflect.type of this field is Object , and .js gives back Date.
While build folder contains:
__metadata("design:type", Date)

Decorator function:

export function DateTimeField(options: DateTimeFieldDecoratorOptions) {
    return (target: any, name: string, descr?: any) => {
        validatePropertyDecorator(target, name, descr);

        const reflectType = Reflect.getMetadata("design:type", target, name);
        checkReflectType(reflectType, Date, name);

        const field = getOrCreateField(target, name);
        Object.assign(field, options, {type: ResourceFieldType.DateTime});
    }
}

Tell me please if I need to provide you with some more info?

@blakeembrey
Copy link
Member

Duplicate of #511. See also https://github.com/TypeStrong/ts-node#features. This will likely be reverted in the future.

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

No branches or pull requests

2 participants