typescript - Why length should be subtype of the indexer? -
i see example in typescript handbook @ here. don't understand why length
property not valid?
interface dictionary { [index: string]: string; length: number; // error, type of 'length' not subtype of indexer }
because x['length']
number, said indexing x
string produces string. can't both true.
Comments
Post a Comment