Add declaration emit tests for readonly parameter property

This commit is contained in:
Andy Hanson
2016-05-11 13:14:22 -07:00
parent a9742c5861
commit 02f2ed798f
4 changed files with 41 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
//// [declarationEmit_readonly.ts]
class C {
constructor(readonly x: number) {}
}
//// [declarationEmit_readonly.js]
var C = (function () {
function C(x) {
this.x = x;
}
return C;
}());
//// [declarationEmit_readonly.d.ts]
declare class C {
readonly x: number;
constructor(x: number);
}

View File

@@ -0,0 +1,8 @@
=== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmit_readonly.ts ===
class C {
>C : Symbol(C, Decl(declarationEmit_readonly.ts, 0, 0))
constructor(readonly x: number) {}
>x : Symbol(C.x, Decl(declarationEmit_readonly.ts, 2, 16))
}

View File

@@ -0,0 +1,8 @@
=== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmit_readonly.ts ===
class C {
>C : C
constructor(readonly x: number) {}
>x : number
}

View File

@@ -0,0 +1,5 @@
// @declaration: true
class C {
constructor(readonly x: number) {}
}