mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
71 lines
3.2 KiB
Plaintext
71 lines
3.2 KiB
Plaintext
constDeclarations-invalidContexts.ts(3,5): error TS1156: 'const' declarations can only be declared inside a block.
|
|
constDeclarations-invalidContexts.ts(5,5): error TS1156: 'const' declarations can only be declared inside a block.
|
|
constDeclarations-invalidContexts.ts(8,5): error TS1156: 'const' declarations can only be declared inside a block.
|
|
constDeclarations-invalidContexts.ts(11,5): error TS1156: 'const' declarations can only be declared inside a block.
|
|
constDeclarations-invalidContexts.ts(15,1): error TS1101: 'with' statements are not allowed in strict mode.
|
|
constDeclarations-invalidContexts.ts(15,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.
|
|
constDeclarations-invalidContexts.ts(19,5): error TS1156: 'const' declarations can only be declared inside a block.
|
|
constDeclarations-invalidContexts.ts(22,5): error TS1156: 'const' declarations can only be declared inside a block.
|
|
constDeclarations-invalidContexts.ts(25,5): error TS1344: A label is not allowed here.
|
|
constDeclarations-invalidContexts.ts(25,12): error TS1156: 'const' declarations can only be declared inside a block.
|
|
constDeclarations-invalidContexts.ts(28,21): error TS1344: A label is not allowed here.
|
|
constDeclarations-invalidContexts.ts(28,29): error TS1156: 'const' declarations can only be declared inside a block.
|
|
|
|
|
|
==== constDeclarations-invalidContexts.ts (12 errors) ====
|
|
// Errors, const must be defined inside a block
|
|
if (true)
|
|
const c1 = 0;
|
|
~~~~~~~~~~~~~
|
|
!!! error TS1156: 'const' declarations can only be declared inside a block.
|
|
else
|
|
const c2 = 0;
|
|
~~~~~~~~~~~~~
|
|
!!! error TS1156: 'const' declarations can only be declared inside a block.
|
|
|
|
while (true)
|
|
const c3 = 0;
|
|
~~~~~~~~~~~~~
|
|
!!! error TS1156: 'const' declarations can only be declared inside a block.
|
|
|
|
do
|
|
const c4 = 0;
|
|
~~~~~~~~~~~~~
|
|
!!! error TS1156: 'const' declarations can only be declared inside a block.
|
|
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 c5 = 0; // No Error will be reported here since we turn off all type checking
|
|
|
|
for (var i = 0; i < 10; i++)
|
|
const c6 = 0;
|
|
~~~~~~~~~~~~~
|
|
!!! error TS1156: 'const' declarations can only be declared inside a block.
|
|
|
|
for (var i2 in {})
|
|
const c7 = 0;
|
|
~~~~~~~~~~~~~
|
|
!!! error TS1156: 'const' declarations can only be declared inside a block.
|
|
|
|
if (true)
|
|
label: const c8 = 0;
|
|
~~~~~
|
|
!!! error TS1344: A label is not allowed here.
|
|
~~~~~~~~~~~~~
|
|
!!! error TS1156: 'const' declarations can only be declared inside a block.
|
|
|
|
while (false)
|
|
label2: label3: label4: const c9 = 0;
|
|
~~~~~~
|
|
!!! error TS1344: A label is not allowed here.
|
|
~~~~~~~~~~~~~
|
|
!!! error TS1156: 'const' declarations can only be declared inside a block.
|
|
|
|
|
|
|
|
|