kibana/packages/kbn-securitysolution-grouping
Kevin Qualters 1c75903f92
[Security Solution] getDataViewStateFromIndexFields was using wrong type as part of a cast (#158594)
## Summary

Fixes an issue with the field browser where all types currently display
as unkown, this was because in a code path where a type cast happens, we
were using the wrong type. To see this, remove the as unknown from the
cast, and the typescript compiler will show the problem:
```
'BrowserField' is deprecated.ts(6385)
index.ts(70, 4): The declaration was marked as deprecated here.
Conversion of type 'DataViewField' to type 'BrowserField' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Type 'DataViewField' is missing the following properties from type 'BrowserField': category, description, example, fields, and 2 more.ts(2352)
```
DataViewField actually only has spec and kbnFieldType properties, spec
is of type FieldSpec which is basically the same type as BrowserField,
and has sufficient overlap for the (still unsafe, but more safe than as
unknown) cast to occur.

Before:
<img width="338" alt="image"
src="f31c1f9e-25f0-41ee-9e1c-a70171e41d29">


After:
<img width="555" alt="image"
src="8b462477-2dce-41bb-9592-f34b20634b84">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-05-31 17:13:36 -04:00
..
.storybook [Security Solution] Multi level grouping for alerts table (#152862) 2023-04-24 07:01:05 -06:00
src [Security Solution] getDataViewStateFromIndexFields was using wrong type as part of a cast (#158594) 2023-05-31 17:13:36 -04:00
index.tsx [Security Solution] Multi level grouping for alerts table (#152862) 2023-04-24 07:01:05 -06:00
jest.config.js [Security solution] Grouping UI package (#152385) 2023-03-02 12:03:25 -07:00
kibana.jsonc [Security solution] Grouping UI package (#152385) 2023-03-02 12:03:25 -07:00
package.json [Security solution] Grouping UI package (#152385) 2023-03-02 12:03:25 -07:00
README.mdx [Security Solution] Multi level grouping for alerts table (#152862) 2023-04-24 07:01:05 -06:00
setup_test.ts [Security solution] Grouping UI package (#152385) 2023-03-02 12:03:25 -07:00
tsconfig.json [Security solution] Fix grouping query, be ready for arrays! (#157330) 2023-05-11 17:03:16 -06:00

# @kbn/securitysolution-grouping

Grouping component and query. Currently only consumed by security solution alerts table.