Sparked off from an discussion in #17389 (comment)
Thus far discovered:
We have ISummaryExpression that's public, but not documented. It's exported and listed in the API docs https://www.infragistics.com/api/angular/igniteui-angular/22.0.0/interfaces/ISummaryExpression/, yet it's not used anywhere. - I don't see it in docs and/or samples https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid/summaries
There's exactly 1 use of ISummaryExpression and that's in a protected method:
|
protected _multipleSummaries(expressions: ISummaryExpression[], hasSummary: boolean) { |
However, that method is in:
|
/** |
|
* Enables summaries for the specified column and applies your customSummary. |
|
* |
|
* @remarks |
|
* If you do not provide the customSummary, then the default summary for the column data type will be applied. |
|
* @example |
|
* ```typescript |
|
* grid.enableSummaries([{ fieldName: 'ProductName' }, { fieldName: 'ID' }]); |
|
* ``` |
|
* Enable summaries for the listed columns. |
|
* @example |
|
* ```typescript |
|
* grid.enableSummaries('ProductName'); |
|
* ``` |
|
* @param rest |
|
*/ |
|
public enableSummaries(...rest) { |
|
if (rest.length === 1 && Array.isArray(rest[0])) { |
|
this._multipleSummaries(rest[0], true); |
Seems to me
rest is actually
ISummaryExpression[], technically
ISummaryExpression[] | [fieldName: string, customSummary?: any] (destructed ISummaryExpression)?! looking at the way the description/logic is, but that should really be in
overloads instead. Also the spread might be absolute bull, considering the logic uses
[0] a lot... -.-
Pretty sure the same thing applies to the equivalent
public disableSummaries() on first glance.
Then there's the customSummary prop:
|
export interface ISummaryExpression { |
|
fieldName: string; |
|
/* blazorCSSuppress */ |
|
customSummary?: any; |
|
} |
Whatever that is kind of hard to track, but it appears that's actually be
IgxSummaryOperand but that's tracked from it being assigned to the respective column
summaries, which opens another can of worms:
IgxSummaryOperand is a class, with seemingly abstract static count(), of course none of that is disclosed on the type
- Samples usage just ignores the type entirely on what's passed to the column
class MySummary { ... }
- And that's because the column
summaries is untyped as well 🫠:
|
public get summaries(): any { |
I've confirmed that's how the API entered initially (see #845) and there's nothing of note described in https://github.com/IgniteUI/igniteui-angular/wiki/Summaries-Specification, so usage mostly needs to be inferred from tests and samples I guess.
Bottomline:
- Clean up the Grid summaries API & update the spec
- Update docs & samples guidance
- Enable
noImplicitAny/strict and consider lint no-explicit-any errors in general. Beyond user-provided data and derived values, any is rarely an acceptable type on public API.
Sparked off from an discussion in #17389 (comment)
Thus far discovered:
We have
ISummaryExpressionthat's public, but not documented. It's exported and listed in the API docs https://www.infragistics.com/api/angular/igniteui-angular/22.0.0/interfaces/ISummaryExpression/, yet it's not used anywhere. - I don't see it in docs and/or samples https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid/summariesThere's exactly 1 use of
ISummaryExpressionand that's in a protected method:igniteui-angular/projects/igniteui-angular/grids/grid/src/grid-base.directive.ts
Line 7290 in 9ad405c
However, that method is in:
igniteui-angular/projects/igniteui-angular/grids/grid/src/grid-base.directive.ts
Lines 5135 to 5153 in 9ad405c
Seems to me
restis actuallyISummaryExpression[], technicallyISummaryExpression[] | [fieldName: string, customSummary?: any] (destructed ISummaryExpression)?! looking at the way the description/logic is, but that should really be in overloads instead. Also the spread might be absolute bull, considering the logic uses[0]a lot... -.-Pretty sure the same thing applies to the equivalent
public disableSummaries()on first glance.Then there's the
customSummaryprop:igniteui-angular/projects/igniteui-angular/core/src/data-operations/grid-types.ts
Lines 435 to 439 in 9ad405c
Whatever that is kind of hard to track, but it appears that's actually be
IgxSummaryOperandbut that's tracked from it being assigned to the respective columnsummaries, which opens another can of worms:IgxSummaryOperandis a class, with seemingly abstractstatic count(), of course none of that is disclosed on the typeclass MySummary { ... }summariesis untyped as well 🫠:igniteui-angular/projects/igniteui-angular/grids/core/src/columns/column.component.ts
Line 1126 in 9ad405c
I've confirmed that's how the API entered initially (see #845) and there's nothing of note described in https://github.com/IgniteUI/igniteui-angular/wiki/Summaries-Specification, so usage mostly needs to be inferred from tests and samples I guess.
Bottomline:
noImplicitAny/strictand consider lintno-explicit-anyerrors in general. Beyond user-provided data and derived values,anyis rarely an acceptable type on public API.