Typings support (#737)
* Updated scripts * Updated .gitignore * Removed symbols * Fixed typo * Added typings * Updated test * Added typings test
This commit is contained in:
committed by
GitHub
parent
db73802af9
commit
ab1d7ba992
29
test/types/index.ts
Normal file
29
test/types/index.ts
Normal 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) => {})
|
||||
Reference in New Issue
Block a user