mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
53 lines
1.3 KiB
Plaintext
53 lines
1.3 KiB
Plaintext
classStaticBlockUseBeforeDef3.ts(14,21): error TS2448: Block-scoped variable 'FOO' used before its declaration.
|
|
classStaticBlockUseBeforeDef3.ts(14,21): error TS2454: Variable 'FOO' is used before being assigned.
|
|
|
|
|
|
==== classStaticBlockUseBeforeDef3.ts (2 errors) ====
|
|
class A {
|
|
static {
|
|
A.doSomething(); // should not error
|
|
}
|
|
|
|
static doSomething() {
|
|
console.log("gotcha!");
|
|
}
|
|
}
|
|
|
|
|
|
class Baz {
|
|
static {
|
|
console.log(FOO); // should error
|
|
~~~
|
|
!!! error TS2448: Block-scoped variable 'FOO' used before its declaration.
|
|
!!! related TS2728 classStaticBlockUseBeforeDef3.ts:18:7: 'FOO' is declared here.
|
|
~~~
|
|
!!! error TS2454: Variable 'FOO' is used before being assigned.
|
|
}
|
|
}
|
|
|
|
const FOO = "FOO";
|
|
class Bar {
|
|
static {
|
|
console.log(FOO); // should not error
|
|
}
|
|
}
|
|
|
|
let u = "FOO" as "FOO" | "BAR";
|
|
|
|
class CFA {
|
|
static {
|
|
u = "BAR";
|
|
u; // should be "BAR"
|
|
}
|
|
|
|
static t = 1;
|
|
|
|
static doSomething() {}
|
|
|
|
static {
|
|
u; // should be "BAR"
|
|
}
|
|
}
|
|
|
|
u; // should be "BAR"
|
|
|