mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
64 lines
1.3 KiB
Plaintext
64 lines
1.3 KiB
Plaintext
controlFlowAutoAccessor1.ts(54,19): error TS7008: Member 'value' implicitly has an 'any' type.
|
|
|
|
|
|
==== controlFlowAutoAccessor1.ts (1 errors) ====
|
|
class Example {
|
|
accessor test;
|
|
|
|
constructor(test: number) {
|
|
this.test = test;
|
|
}
|
|
|
|
getTest() {
|
|
return this.test;
|
|
}
|
|
}
|
|
|
|
class Example2 {
|
|
accessor test;
|
|
|
|
constructor(test: number | undefined) {
|
|
this.test = test;
|
|
}
|
|
|
|
getTest() {
|
|
if (this.test) {
|
|
return this.test;
|
|
}
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
// https://github.com/microsoft/TypeScript/issues/59728
|
|
|
|
class Example3 {
|
|
accessor value;
|
|
|
|
constructor(n: number) {
|
|
this.value = n;
|
|
|
|
if (n < 0) {
|
|
this.value = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
declare var n: number;
|
|
class Example4 {
|
|
static accessor value;
|
|
static {
|
|
this.value = n;
|
|
if (n < 0) {
|
|
this.value = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
class Example5 {
|
|
static accessor value; // error
|
|
~~~~~
|
|
!!! error TS7008: Member 'value' implicitly has an 'any' type.
|
|
}
|
|
Example5.value = 123;
|
|
Example5.value++;
|
|
|