[Backport 8.2] Update TypeScript docs and export estypes (#1676)

Co-authored-by: Tomas Della Vedova <delvedor@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2022-04-12 10:34:56 +02:00
committed by GitHub
parent 295553c249
commit de27dd9697
3 changed files with 14 additions and 0 deletions

View File

@ -51,5 +51,6 @@ Paste the results here:
- *node version*: 6,8,10
- `@elastic/elasticsearch` *version*: >=7.0.0
- *typescript version*: 4.x (if applicable)
- *os*: Mac, Windows, Linux
- *any other relevant information*

View File

@ -7,6 +7,10 @@ of type definitions of Elasticsearch's API surface.
The types are not 100% complete yet. Some APIs are missing (the newest ones, e.g. EQL),
and others may contain some errors, but we are continuously pushing fixes & improvements.
NOTE: The client is developed against the https://www.npmjs.com/package/typescript?activeTab=versions[latest]
version of TypeScript. Furthermore, unless you have set `skipLibCheck` to `true`,
you should configure `esModuleInterop` to `true`.
[discrete]
==== Example
@ -77,3 +81,10 @@ You can import the full TypeScript requests & responses definitions as it follow
----
import { estypes } from '@elastic/elasticsearch'
----
If you need the legacy definitions with the body, you can do the following:
[source,ts]
----
import { estypesWithBody } from '@elastic/elasticsearch'
----

2
index.d.ts vendored
View File

@ -21,5 +21,7 @@ import Client from './lib/client'
import SniffingTransport from './lib/sniffingTransport'
export * from '@elastic/transport'
export * as estypes from './lib/api/types'
export * as estypesWithBody from './lib/api/types'
export { Client, SniffingTransport }
export type { ClientOptions, NodeOptions } from './lib/client'