TypeScript/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt

53 lines
3.1 KiB
Plaintext
Raw Normal View History

tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(3,5): error TS7008: Member 'getAndSet' implicitly has an 'any' type.
tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(4,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,5): error TS7016: Property 'haveOnlySet' implicitly has type 'any', because its 'set' accessor lacks a type annotation.
tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,28): error TS7006: Parameter 'newXValue' implicitly has an 'any' type.
tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,5): error TS7010: 'haveOnlyGet', which lacks return-type annotation, implicitly has an 'any' return type.
tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
==== tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts (8 errors) ====
2014-07-13 01:04:16 +02:00
// these should be errors
class GetAndSet {
getAndSet = null; // error at "getAndSet"
~~~~~~~~~~~~~~~~~
!!! error TS7008: Member 'getAndSet' implicitly has an 'any' type.
2014-07-13 01:04:16 +02:00
public get haveGetAndSet() { // this should not be an error
~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
2014-07-13 01:04:16 +02:00
return this.getAndSet;
}
// this shouldn't be an error
public set haveGetAndSet(value) { // error at "value"
~~~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
2014-07-13 01:04:16 +02:00
this.getAndSet = value;
}
}
class SetterOnly {
public set haveOnlySet(newXValue) { // error at "haveOnlySet, newXValue"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2014-07-13 01:04:16 +02:00
~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
2014-07-13 01:04:16 +02:00
~~~~~~~~~
!!! error TS7006: Parameter 'newXValue' implicitly has an 'any' type.
2014-07-13 01:04:16 +02:00
}
~~~~~
!!! error TS7016: Property 'haveOnlySet' implicitly has type 'any', because its 'set' accessor lacks a type annotation.
2014-07-13 01:04:16 +02:00
}
class GetterOnly {
public get haveOnlyGet() { // error at "haveOnlyGet"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2014-07-13 01:04:16 +02:00
~~~~~~~~~~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
2014-07-13 01:04:16 +02:00
return null;
~~~~~~~~~~~~~~~~~~~~
}
~~~~~
!!! error TS7010: 'haveOnlyGet', which lacks return-type annotation, implicitly has an 'any' return type.
2014-07-13 01:04:16 +02:00
}