mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Add test for the decorated method beginning with underscore
This commit is contained in:
committed by
Mohamed Hegazy
parent
2cec8dbe84
commit
86f69f13fa
18
tests/cases/compiler/decoratorWithUnderscoreMethod.ts
Normal file
18
tests/cases/compiler/decoratorWithUnderscoreMethod.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
// @noemithelpers: true
|
||||
// @experimentaldecorators: true
|
||||
|
||||
declare var console : { log(arg: string): void };
|
||||
function dec(): Function {
|
||||
return function (target: any, propKey: string, descr: PropertyDescriptor): void {
|
||||
console.log(target[propKey]);
|
||||
//logs undefined
|
||||
//propKey has three underscores as prefix, but the method has only two underscores
|
||||
};
|
||||
}
|
||||
|
||||
class A {
|
||||
@dec()
|
||||
private __foo(bar: string): void {
|
||||
// do something with bar
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user