mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
46 lines
651 B
TypeScript
46 lines
651 B
TypeScript
//// [tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts] ////
|
|
|
|
//// [constDeclarationShadowedByVarDeclaration.ts]
|
|
// Error as declaration of var would cause a write to the const value
|
|
var x = 0;
|
|
{
|
|
const x = 0;
|
|
|
|
var x = 0;
|
|
}
|
|
|
|
|
|
var y = 0;
|
|
{
|
|
const y = 0;
|
|
{
|
|
var y = 0;
|
|
}
|
|
}
|
|
|
|
|
|
{
|
|
const z = 0;
|
|
var z = 0
|
|
}
|
|
|
|
//// [constDeclarationShadowedByVarDeclaration.js]
|
|
"use strict";
|
|
// Error as declaration of var would cause a write to the const value
|
|
var x = 0;
|
|
{
|
|
const x = 0;
|
|
var x = 0;
|
|
}
|
|
var y = 0;
|
|
{
|
|
const y = 0;
|
|
{
|
|
var y = 0;
|
|
}
|
|
}
|
|
{
|
|
const z = 0;
|
|
var z = 0;
|
|
}
|