Reputation: 141
here is my typscript code -
export default class CModel{
CName:string;
[Symbol.iterator]: function* () {
yield 1;
}
}
here is my error list-
Upvotes: 1
Views: 59
Reputation: 222548
[Symbol.iterator]: ...
designates a type, doesn't assign a value. function* () { ... }
is not a type, it's actual function.
If the intention is to assign Symbol.iterator
property on class instance, it should be:
export default class CModel{
CName:string;
[Symbol.iterator] = function* () {
yield 1;
}
}
Upvotes: 1