Skip to content

Commit c32227d

Browse files
author
Andy Hanson
committed
Add test for lambda parameter named 'readonly'
1 parent 2a76af2 commit c32227d

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

tests/baselines/reference/readonlyInNonPropertyParameters.errors.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ tests/cases/compiler/readonlyInNonPropertyParameters.ts(7,2): error TS2369: A pa
1616
}
1717
(readonly x) => 0;
1818
~~~~~~~~~~
19-
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
19+
!!! error TS2369: A parameter property is only allowed in a constructor implementation.
20+
// OK to use `readonly` as a name
21+
(readonly) => 0;

tests/baselines/reference/readonlyInNonPropertyParameters.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ class X {
55
method(readonly x: number) {}
66
set x(readonly value: number) {}
77
}
8-
(readonly x) => 0;
8+
(readonly x) => 0;
9+
// OK to use `readonly` as a name
10+
(readonly) => 0;
911

1012
//// [readonlyInNonPropertyParameters.js]
1113
// `readonly` won't work outside of property parameters
@@ -21,3 +23,5 @@ var X = (function () {
2123
return X;
2224
}());
2325
(function (x) { return 0; });
26+
// OK to use `readonly` as a name
27+
(function (readonly) { return 0; });

tests/cases/compiler/readonlyInNonPropertyParameters.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ class X {
55
method(readonly x: number) {}
66
set x(readonly value: number) {}
77
}
8-
(readonly x) => 0;
8+
(readonly x) => 0;
9+
// OK to use `readonly` as a name
10+
(readonly) => 0;

0 commit comments

Comments
 (0)