Skip to content

Commit 4c8db9c

Browse files
author
Andy Hanson
committed
Add declaration emit tests for readonly parameter property
1 parent d7f246d commit 4c8db9c

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//// [declarationEmit_readonly.ts]
2+
3+
class C {
4+
constructor(readonly x: number) {}
5+
}
6+
7+
//// [declarationEmit_readonly.js]
8+
var C = (function () {
9+
function C(x) {
10+
this.x = x;
11+
}
12+
return C;
13+
}());
14+
15+
16+
//// [declarationEmit_readonly.d.ts]
17+
declare class C {
18+
readonly x: number;
19+
constructor(x: number);
20+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
=== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmit_readonly.ts ===
2+
3+
class C {
4+
>C : Symbol(C, Decl(declarationEmit_readonly.ts, 0, 0))
5+
6+
constructor(readonly x: number) {}
7+
>x : Symbol(C.x, Decl(declarationEmit_readonly.ts, 2, 16))
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
=== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmit_readonly.ts ===
2+
3+
class C {
4+
>C : C
5+
6+
constructor(readonly x: number) {}
7+
>x : number
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// @declaration: true
2+
3+
class C {
4+
constructor(readonly x: number) {}
5+
}

0 commit comments

Comments
 (0)