mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
Report error for block scope function declaration in ES5
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts(3,14): error TS1250: In ES5 or lower, function declarations are not allowed in block scope in strict mode.
|
||||
tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts(6,1): error TS2304: Cannot find name 'foo'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts (1 errors) ====
|
||||
==== tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts (2 errors) ====
|
||||
"use strict";
|
||||
if (true) {
|
||||
function foo() { } // Error to declare function in block scope
|
||||
~~~
|
||||
!!! error TS1250: In ES5 or lower, function declarations are not allowed in block scope in strict mode.
|
||||
foo(); // This call should be ok
|
||||
}
|
||||
foo(); // Error to find name foo
|
||||
|
||||
Reference in New Issue
Block a user