TypeScript/tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts
2014-07-12 17:30:19 -07:00

24 lines
577 B
TypeScript

//@noimplicitany: true
// these should be errors
class GetAndSet {
getAndSet = null; // error at "getAndSet"
public get haveGetAndSet() { // this should not be an error
return this.getAndSet;
}
// this shouldn't be an error
public set haveGetAndSet(value) { // error at "value"
this.getAndSet = value;
}
}
class SetterOnly {
public set haveOnlySet(newXValue) { // error at "haveOnlySet, newXValue"
}
}
class GetterOnly {
public get haveOnlyGet() { // error at "haveOnlyGet"
return null;
}
}