Typings support (#737)

* Updated scripts

* Updated .gitignore

* Removed symbols

* Fixed typo

* Added typings

* Updated test

* Added typings test
This commit is contained in:
Tomas Della Vedova
2018-11-30 17:01:55 +01:00
committed by GitHub
parent db73802af9
commit ab1d7ba992
16 changed files with 869 additions and 45 deletions

29
test/types/index.ts Normal file
View File

@ -0,0 +1,29 @@
'use strict'
import { Client, ApiResponse } from '../../index'
const client = new Client({ node: 'http://localhost:9200' })
// Callbacks
client.info((err: Error | null, result: ApiResponse) => {})
client.index({
index: 'test',
type: 'test',
id: 'test',
body: { hello: 'world' }
}, (err: Error | null, result: ApiResponse) => {})
// Promises
client.info()
.then((result: ApiResponse) => {})
.catch((err: Error) => {})
client.index({
index: 'test',
type: 'test',
id: 'test',
body: { hello: 'world' }
})
.then((result: ApiResponse) => {})
.catch((err: Error) => {})