Files
tsgo/testdata/baselines/reference/submodule/compiler/constDeclarations-scopes(alwaysstrict=true).errors.txt
2026-04-03 17:52:40 +00:00

161 lines
3.1 KiB
Plaintext

constDeclarations-scopes.ts(27,1): error TS1101: 'with' statements are not allowed in strict mode.
constDeclarations-scopes.ts(27,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
constDeclarations-scopes.ts(43,5): error TS1344: A label is not allowed here.
constDeclarations-scopes.ts(48,21): error TS1344: A label is not allowed here.
==== constDeclarations-scopes.ts (4 errors) ====
// global
const c = "string";
var n: number;
// Control flow statements with blocks
if (true) {
const c = 0;
n = c;
}
else {
const c = 0;
n = c;
}
while (true) {
const c = 0;
n = c;
}
do {
const c = 0;
n = c;
} while (true);
var obj;
with (obj) {
~~~~
!!! error TS1101: 'with' statements are not allowed in strict mode.
~~~~~~~~~~
!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
const c = 0;
n = c;
}
for (var i = 0; i < 10; i++) {
const c = 0;
n = c;
}
for (var i2 in {}) {
const c = 0;
n = c;
}
if (true) {
label: const c = 0;
~~~~~
!!! error TS1344: A label is not allowed here.
n = c;
}
while (false) {
label2: label3: label4: const c = 0;
~~~~~~
!!! error TS1344: A label is not allowed here.
n = c;
}
// Try/catch/finally
try {
const c = 0;
n = c;
}
catch (e) {
const c = 0;
n = c;
}
finally {
const c = 0;
n = c;
}
// Switch
switch (0) {
case 0:
const c = 0;
n = c;
break;
}
// blocks
{
const c = 0;
n = c;
{
const c = false;
var b: boolean = c;
}
}
// functions
function F() {
const c = 0;
n = c;
}
var F2 = () => {
const c = 0;
n = c;
};
var F3 = function () {
const c = 0;
n = c;
};
// modules
namespace m {
const c = 0;
n = c;
{
const c = false;
var b2: boolean = c;
}
}
// methods
class C {
constructor() {
const c = 0;
n = c;
}
method() {
const c = 0;
n = c;
}
get v() {
const c = 0;
n = c;
return n;
}
set v(value) {
const c = 0;
n = c;
}
}
// object literals
var o = {
f() {
const c = 0;
n = c;
},
f2: () => {
const c = 0;
n = c;
}
}