elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.58k stars 8.21k forks source link

Clean the global type definitions up #117366

Open mshustov opened 2 years ago

mshustov commented 2 years ago

Global typings stored in the typings folder are mostly used to declare typings for a package without official typings. The problem is that these typings aren't curated and not updated. To enforce ownerships for the typings, we should move type declaration to plugins relying on the declarations for cases when global type definitions are used by 1-2 plugins. Other type definitions relevant for the whole Kibana repo will remain in /typings folder and will be owned by the Kibana Core team.

elasticmachine commented 2 years ago

Pinging @elastic/kibana-core (Team:Core)

spalger commented 2 years ago

I'd really like us to move to isolatedModules across the board and I'm pretty sure that relying on ambient type definitions like this are going to prevent that from being possible. I think that it might make sense to create @types/* packages for these modules (either on npm or in the repo) or just require that people use @ts-expect-error to highlight a little more locally that these types are not available and that there is no type safely when using these packages.

mshustov commented 2 years ago

I think that it might make sense to create @types/* packages for these modules (either on npm or in the repo)

And contribute and update the deps whenever possible. there is 'rison-node' package which is widely used across Kibana, I'm not sure why we don't contribute to https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/rison/index.d.ts

spalger commented 2 years ago

DefinitelyTypes is definitely intimidating, but yeah, it would be helpful to everyone if we pushed some basic type definitions for the modules we're using

lukeelmers commented 2 years ago

And contribute and update the deps whenever possible. there is 'rison-node' package which is widely used across Kibana, I'm not sure why we don't contribute to DefinitelyTyped/DefinitelyTyped@master/types/rison/index.d.ts

Just an aside on this, since you mentioned rison-node -- we are (were) actually publishing a fork of it, which is what Kibana uses and is different from the original rison package https://github.com/w33ble/rison-node

Currently owned by @elastic/kibana-app-services. We probably should pull the fork into Kibana at some point since we don't have control over that repo anymore.