File tree 2 files changed +4
-4
lines changed
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -83,9 +83,9 @@ namespace ts {
83
83
// extra cost of calling `getParseTreeNode` when calling these functions from inside the
84
84
// checker.
85
85
const checker: TypeChecker = {
86
- getNodeCount: () => sum(host.getSourceFiles(), "nodeCount"),
87
- getIdentifierCount: () => sum(host.getSourceFiles(), "identifierCount"),
88
- getSymbolCount: () => sum(host.getSourceFiles(), "symbolCount") + symbolCount,
86
+ getNodeCount: () => sum<"nodeCount"> (host.getSourceFiles(), "nodeCount"),
87
+ getIdentifierCount: () => sum<"identifierCount"> (host.getSourceFiles(), "identifierCount"),
88
+ getSymbolCount: () => sum<"symbolCount"> (host.getSourceFiles(), "symbolCount") + symbolCount,
89
89
getTypeCount: () => typeCount,
90
90
isUndefinedSymbol: symbol => symbol === undefinedSymbol,
91
91
isArgumentsSymbol: symbol => symbol === argumentsSymbol,
Original file line number Diff line number Diff line change @@ -700,7 +700,7 @@ namespace ts {
700
700
return result ;
701
701
}
702
702
703
- export function sum ( array : any [ ] , prop : string ) : number {
703
+ export function sum < K extends string > ( array : { [ x in K ] : number } [ ] , prop : K ) : number {
704
704
let result = 0 ;
705
705
for ( const v of array ) {
706
706
result += v [ prop ] ;
You can’t perform that action at this time.
0 commit comments