Skip to content

Commit 951f22d

Browse files
bhovhannescitizensas
authored andcommitted
fix: upgrade to the latest typescript
1 parent 63b5f79 commit 951f22d

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/Api.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class Api {
113113
if (subdomain !== undefined) {
114114
loginParams['subdomain'] = subdomain
115115
}
116-
return new Promise((resolve, reject) => {
116+
return new Promise<string>((resolve, reject) => {
117117
if (typeof this._httpOptions.headers.apiKey !== 'undefined') {
118118
resolve(this._httpOptions.headers.apiKey)
119119
} else {
@@ -186,8 +186,8 @@ export class Api {
186186
* @return {Promise} A promise which will resolved if everything went ok and rejected otherwise
187187
*/
188188
clearApiKey() {
189-
return new Promise((resolve, reject) => {
190-
const req = this.execute('USER', null, 'clearApiKey') as Promise<any>
189+
return new Promise<void>((resolve, reject) => {
190+
const req = this.execute('USER', null, 'clearApiKey')
191191
req.then((result) => {
192192
if (result) {
193193
delete this._httpOptions.headers.apiKey
@@ -317,10 +317,10 @@ export class Api {
317317
* @memberOf Api
318318
* @return {Promise} A promise which will resolved if everything went ok and rejected otherwise
319319
*/
320-
logout(): Promise<undefined> {
321-
return new Promise((resolve, reject) => {
320+
logout(): Promise<void> {
321+
return new Promise<void>((resolve, reject) => {
322322
const req = this.request('logout', null, null, Api.Methods.GET)
323-
;(req as Promise<any>).then((result) => {
323+
req.then((result) => {
324324
if (result && result.success) {
325325
delete this._httpOptions.headers['X-XSRF-TOKEN']
326326
delete this._httpOptions.headers.sessionID
@@ -368,14 +368,14 @@ export class Api {
368368
* @param {Boolean} [bForce] Pass true to cause the server to remove the specified data and its dependants
369369
* @returns {Promise} A promise which will resolved if everything went ok and rejected otherwise
370370
*/
371-
remove(objCode: string, objID: string, bForce?: boolean): Promise<undefined> {
371+
remove(objCode: string, objID: string, bForce?: boolean): Promise<void> {
372372
const params = bForce ? {force: true} : null
373373
const req = this.request(objCode + '/' + objID, params, null, Api.Methods.DELETE)
374374

375375
if (this._uriGenerationMode) {
376376
return req
377377
} else {
378-
return new Promise((resolve, reject) => {
378+
return new Promise<void>((resolve, reject) => {
379379
;(req as Promise<any>).then((result) => {
380380
if (result && result.success) {
381381
resolve()
@@ -496,7 +496,7 @@ export class Api {
496496
*
497497
* @param {boolean} isConcurrent Requests to the DB are made asynchronously.
498498
*
499-
* @returns {Promise<any[] | undefined>}
499+
* @returns {Promise<any[] | void>}
500500
*/
501501
batch(
502502
uriCollector: (batchApi: IBatchApi) => string[],
@@ -507,12 +507,12 @@ export class Api {
507507
uriCollector: (batchApi: IBatchApi) => string[],
508508
isAtomic?: true,
509509
isConcurrent?: boolean
510-
): Promise<undefined>
510+
): Promise<void>
511511
batch(
512512
uriCollector: (batchApi: IBatchApi) => string[],
513513
isAtomic?: boolean,
514514
isConcurrent?: boolean
515-
): Promise<any[] | undefined> {
515+
): Promise<any[] | void> {
516516
const batchApi = batchApiFactory(this)
517517
const uris = uriCollector(batchApi)
518518
if (uris.length === 0) {

0 commit comments

Comments
 (0)