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

Wrong running order #17

Open
replace5 opened this issue Apr 3, 2020 · 0 comments
Open

Wrong running order #17

replace5 opened this issue Apr 3, 2020 · 0 comments

Comments

@replace5
Copy link

replace5 commented Apr 3, 2020

`function ClassDecorator() {
return function (target) {
console.log("I am class decorator");
};
}
function MethodDecorator() {
return function (target, methodName: string, descriptor: PropertyDescriptor) {
console.log("I am method decorator");
};
}
function Param1Decorator() {
return function (target, methodName: string, paramIndex: number) {
console.log("I am parameter1 decorator");
};
}
function Param2Decorator2() {
return function (target, methodName: string, paramIndex: number) {
console.log("I am parameter2 decorator2");
};
}
function MethodDecorator2() {
return function (target, methodName: string, descriptor: PropertyDescriptor) {
console.log("I am method decorator2");
};
}
function Param1Decorator2() {
return function (target, methodName: string, paramIndex: number) {
console.log("I am parameter1 decorator2");
};
}
function Param2Decorator() {
return function (target, methodName: string, paramIndex: number) {
console.log("I am parameter2 decorator");
};
}
function PropertyDecorator() {
return function (target, propertyName: string) {
console.log("I am property decorator");
};
}

@ClassDecorator()
class Hello {
@MethodDecorator2()
greet2(@Param1Decorator2() p1: string, @Param2Decorator2() p2: string) { }

@PropertyDecorator()
greeting: string = "test";

@MethodDecorator()
greet(@Param1Decorator() p1: string, @Param2Decorator() p2: string) { }

}`

run after babel-plugin-parameter-decorator compile

I am parameter1 decorator2
I am parameter2 decorator2
I am parameter1 decorator
I am parameter2 decorator
I am method decorator2
I am property decorator
I am method decorator
I am class decorator

run on typescript playground: https://www.typescriptlang.org/play/?noImplicitAny=false&alwaysStrict=false&declaration=false&experimentalDecorators=true&target=7#

I am parameter2 decorator2
I am parameter1 decorator2
I am method decorator2
I am property decorator
I am parameter2 decorator
I am parameter1 decorator
I am method decorator
I am class decorator

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

1 participant