[ts] Consolidate UI Typescript types, update generate
script
#207137
Labels
enhancement
New value added to drive a business result
Team:Operations
Team label for Operations Team
There are a number of important Typescript declarations that need to be added to the
tsconfig.json
of a package to have it function properly, at least from a UX perspective:@emotion/react/types/css-prop
: Enables thecss=
property on React nodes. Without it, you get a TS error.@kbn/ambient-ui-types
: Enables importingpng
,svg
,html
and others. Without it, you get a TS error.kibana/typings/emotion.d.ts
: Types the parameter passed tocss=
to be equivalent to the EUI theme. [1]. Without it, consumers do not know they have access to the EUI theme, (and call a hook manually).Inclusion of these types should (probably) be in any package that includes React code. Ideally, these would all be consolidated into a single TS type package or reference. Unfortunately,
tsconfig.json
arrays cannot be merged with extending, so even though they're included intsconfig.base.json
, andtsconfig
that extends it and includes thetypes
property, has to copy them wholesale.I tried combining these in various ways-- in the same file, combining references, etc-- but can't get them all to work at the same time.
A test case would be something like:
Some folks have added some of the references, others have included
../../../[etc]/typings/**
as well. It's all very haphazard, and requires past knowledge. Ideally, we'd have a singletsconfig.json
reference, and have it automatically included with the template for--web
packages created byscripts/generate
.As a result, everything would be enabled properly, and we wouldn't have gaps in knowledge or packages.
The text was updated successfully, but these errors were encountered: