@@ -18,7 +18,7 @@ const _handler = (resolve, reject, err, resp) => {
18
18
* @param object
19
19
* @returns {{} }
20
20
*/
21
- export function reverseKeyValues ( object ) {
21
+ export function reverseKeyValues ( object : Object ) : Object {
22
22
const output = { } ;
23
23
for ( const key in object ) {
24
24
output [ object [ key ] ] = key ;
@@ -29,15 +29,15 @@ export function reverseKeyValues(object) {
29
29
/**
30
30
* No operation func
31
31
*/
32
- export function noop ( ) {
32
+ export function noop ( ) : void {
33
33
}
34
34
35
35
/**
36
36
* Wraps a native module method to support promises.
37
37
* @param fn
38
38
* @param NativeModule
39
39
*/
40
- export function promisify ( fn , NativeModule ) {
40
+ export function promisify ( fn : Function , NativeModule : Object ) : Function < Promise > {
41
41
return ( ...args ) => {
42
42
return new Promise ( ( resolve , reject ) => {
43
43
const _fn = typeof fn === 'function' ? fn : NativeModule [ fn ] ;
@@ -56,7 +56,7 @@ export function promisify(fn, NativeModule) {
56
56
* @param callback
57
57
* @private
58
58
*/
59
- function _delayChunk ( collection , chunkSize , operation , callback ) {
59
+ function _delayChunk ( collection , chunkSize , operation , callback ) : void {
60
60
const length = collection . length ;
61
61
const iterations = Math . ceil ( length / chunkSize ) ;
62
62
@@ -84,7 +84,7 @@ function _delayChunk(collection, chunkSize, operation, callback) {
84
84
* @param iterator
85
85
* @param cb
86
86
*/
87
- export function each ( array , chunkSize , iterator , cb ) {
87
+ export function each ( array : Array , chunkSize ?: number , iterator : Function , cb : Function ) : void {
88
88
if ( typeof chunkSize === 'function' ) {
89
89
cb = iterator ;
90
90
iterator = chunkSize ;
@@ -106,7 +106,7 @@ export function each(array, chunkSize, iterator, cb) {
106
106
* @param cb
107
107
* @returns {* }
108
108
*/
109
- export function map ( array , chunkSize , iterator , cb ) {
109
+ export function map ( array : Array , chunkSize ?: number , iterator : Function , cb : Function ) : void {
110
110
if ( typeof chunkSize === 'function' ) {
111
111
cb = iterator ;
112
112
iterator = chunkSize ;
@@ -137,7 +137,7 @@ const lastRandChars = [];
137
137
* @param serverTimeOffset - pass in server time offset from native side
138
138
* @returns {string }
139
139
*/
140
- export function generatePushID ( serverTimeOffset = 0 ) {
140
+ export function generatePushID ( serverTimeOffset ?: number = 0 ) : string {
141
141
const timeStampChars = new Array ( 8 ) ;
142
142
let now = new Date ( ) . getTime ( ) + serverTimeOffset ;
143
143
const duplicateTime = ( now === lastPushTime ) ;
0 commit comments