refactor: Consistently use index access on index signature types. (#28937)
This change helps highlight certain misoptimizations with Closure compiler. It is also stylistically preferable to consistently use index access on index sig types. Roughly, when one sees '.foo' they know it is always checked for typos in the prop name by the type system (unless 'any'), while "['foo']" is always not. Once all angular repos are conforming this will become a tsetse.info check, enforced by bazel. PR Close #28937
This commit is contained in:
@ -420,18 +420,18 @@ export class StaticSymbolResolver {
|
||||
if (!filePath) {
|
||||
return {
|
||||
__symbolic: 'error',
|
||||
message:
|
||||
`Could not resolve ${module} relative to ${self.host.getMetadataFor(sourceSymbol.filePath)}.`,
|
||||
line: map.line,
|
||||
character: map.character,
|
||||
message: `Could not resolve ${module} relative to ${
|
||||
self.host.getMetadataFor(sourceSymbol.filePath)}.`,
|
||||
line: map['line'],
|
||||
character: map['character'],
|
||||
fileName: getOriginalName()
|
||||
};
|
||||
}
|
||||
return {
|
||||
__symbolic: 'resolved',
|
||||
symbol: self.getStaticSymbol(filePath, name),
|
||||
line: map.line,
|
||||
character: map.character,
|
||||
line: map['line'],
|
||||
character: map['character'],
|
||||
fileName: getOriginalName()
|
||||
};
|
||||
} else if (functionParams.indexOf(name) >= 0) {
|
||||
|
@ -249,7 +249,7 @@ class ToJsonSerializer extends ValueTransformer {
|
||||
*/
|
||||
visitStringMap(map: {[key: string]: any}, context: any): any {
|
||||
if (map['__symbolic'] === 'resolved') {
|
||||
return visitValue(map.symbol, this, context);
|
||||
return visitValue(map['symbol'], this, context);
|
||||
}
|
||||
if (map['__symbolic'] === 'error') {
|
||||
delete map['line'];
|
||||
|
Reference in New Issue
Block a user