mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
Add declaration emit tests for readonly parameter property
This commit is contained in:
20
tests/baselines/reference/declarationEmit_readonly.js
Normal file
20
tests/baselines/reference/declarationEmit_readonly.js
Normal 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);
|
||||
}
|
||||
@@ -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))
|
||||
}
|
||||
8
tests/baselines/reference/declarationEmit_readonly.types
Normal file
8
tests/baselines/reference/declarationEmit_readonly.types
Normal file
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/declarationEmit_readonly.ts ===
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
constructor(readonly x: number) {}
|
||||
>x : number
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// @declaration: true
|
||||
|
||||
class C {
|
||||
constructor(readonly x: number) {}
|
||||
}
|
||||
Reference in New Issue
Block a user