TypeScript behavior

I'm doing some simple JavaScript coding exercises in TS and have come across this odd behavior I haven't encountered before.

I have only the following code:
const inputs: Array<Array<any>> = [
  [1, 2, 4, 0],
  [1, 2, [4, 0]],
  [[[2, 3, 4, 5]]],
];


I get the following error:
Cannot redeclare block-scoped variable 'inputs'.ts(2451)
const inputs: any[][]


Did a really quick Google search, and it seems to be because it's in the global scope. So I put it in a function and it works.

Now, when I try this code only and by itself:
const x: String = "Hello";


I get no such error. Why is that?
Was this page helpful?