TypeScript Version: 2.5.3
Code
classMySpecialMapimplementsMap<Object,Object>{private_map;readonly[Symbol.toStringTag]="MySpecialmap";constructor(){this._map=newMap();}// declare all other methods of Map methods with some unique behaviors that wrap calls to this._map. }Expected behavior:
Classes implementing an ES6 interface can declare a distinct value for Symbol.toStringTag.
The goal of this property is to provide a distinct value, using a string literal type for the interface is overly specific.
Actual behavior:
src/MySpecialMap.ts(1,7): error TS2420: Class 'MySpecialMap' incorrectly implements interface 'Map<Object, Object>'.
Types of property '[Symbol.toStringTag]' are incompatible.
Type '"MySpecialMap"' is not assignable to type '"Map"'.
TypeScript Version: 2.5.3
Code
Expected behavior:
Classes implementing an ES6 interface can declare a distinct value for
Symbol.toStringTag.The goal of this property is to provide a distinct value, using a string literal type for the interface is overly specific.
Actual behavior: