@@ -14,7 +14,8 @@ export interface HeightData {
1414}
1515
1616/** checks for obsolete method names */
17- export function obsolete ( self , f , oldName : string , newName : string , rev : string ) {
17+ // eslint-disable-next-line
18+ export function obsolete ( self , f , oldName : string , newName : string , rev : string ) : ( ...args : any [ ] ) => any {
1819 let wrapper = ( ...args ) => {
1920 console . warn ( 'gridstack.js: Function `' + oldName + '` is deprecated in ' + rev + ' and has been replaced ' +
2021 'with `' + newName + '`. It will be **completely** removed in v1.0' ) ;
@@ -25,7 +26,7 @@ export function obsolete(self, f, oldName: string, newName: string, rev: string)
2526}
2627
2728/** checks for obsolete grid options (can be used for any fields, but msg is about options) */
28- export function obsoleteOpts ( opts : GridStackOptions , oldName : string , newName : string , rev : string ) {
29+ export function obsoleteOpts ( opts : GridStackOptions , oldName : string , newName : string , rev : string ) : void {
2930 if ( opts [ oldName ] !== undefined ) {
3031 opts [ newName ] = opts [ oldName ] ;
3132 console . warn ( 'gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + ' and has been replaced with `' +
@@ -34,14 +35,14 @@ export function obsoleteOpts(opts: GridStackOptions, oldName: string, newName: s
3435}
3536
3637/** checks for obsolete grid options which are gone */
37- export function obsoleteOptsDel ( opts : GridStackOptions , oldName : string , rev : string , info : string ) {
38+ export function obsoleteOptsDel ( opts : GridStackOptions , oldName : string , rev : string , info : string ) : void {
3839 if ( opts [ oldName ] !== undefined ) {
3940 console . warn ( 'gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + info ) ;
4041 }
4142}
4243
4344/** checks for obsolete Jquery element attributes */
44- export function obsoleteAttr ( el : HTMLElement , oldName : string , newName : string , rev : string ) {
45+ export function obsoleteAttr ( el : HTMLElement , oldName : string , newName : string , rev : string ) : void {
4546 let oldAttr = el . getAttribute ( oldName ) ;
4647 if ( oldAttr !== null ) {
4748 el . setAttribute ( newName , oldAttr ) ;
@@ -106,14 +107,14 @@ export class Utils {
106107 }
107108
108109 /** removed the given stylesheet id */
109- static removeStylesheet ( id : string ) {
110+ static removeStylesheet ( id : string ) : void {
110111 let el = document . querySelector ( 'STYLE[data-gs-style-id=' + id + ']' ) ;
111112 if ( ! el || ! el . parentNode ) return ;
112113 el . parentNode . removeChild ( el ) ;
113114 }
114115
115116 /** inserts a CSS rule */
116- static addCSSRule ( sheet : CSSStyleSheet , selector : string , rules : string ) {
117+ static addCSSRule ( sheet : CSSStyleSheet , selector : string , rules : string ) : void {
117118 if ( typeof sheet . addRule === 'function' ) {
118119 sheet . addRule ( selector , rules ) ;
119120 } else if ( typeof sheet . insertRule === 'function' ) {
@@ -122,7 +123,7 @@ export class Utils {
122123 }
123124
124125 // eslint-disable-next-line @typescript-eslint/no-explicit-any
125- static toBool ( v : any ) : boolean {
126+ static toBool ( v : unknown ) : boolean {
126127 if ( typeof v === 'boolean' ) {
127128 return v ;
128129 }
@@ -154,6 +155,7 @@ export class Utils {
154155 }
155156
156157 /** copies unset fields in target to use the given default sources values */
158+ // eslint-disable-next-line
157159 static defaults ( target , ...sources ) : { } {
158160
159161 sources . forEach ( source => {
@@ -172,8 +174,9 @@ export class Utils {
172174 }
173175
174176 /** makes a shallow copy of the passed json struct */
177+ // eslint-disable-next-line
175178 static clone ( target : { } ) : { } {
176- return { ...target } ; // was $.extend({}, target)
179+ return { ...target } ;
177180 }
178181
179182 /** return the closest parent matching the given class */
@@ -185,7 +188,7 @@ export class Utils {
185188 }
186189
187190 /** @internal */
188- static throttle ( callback : ( ) => void , delay : number ) {
191+ static throttle ( callback : ( ) => void , delay : number ) : ( ) => void {
189192 let isWaiting = false ;
190193
191194 return ( ...args ) => {
@@ -197,7 +200,7 @@ export class Utils {
197200 }
198201 }
199202
200- static removePositioningStyles ( el : HTMLElement ) {
203+ static removePositioningStyles ( el : HTMLElement ) : void {
201204 let style = el . style ;
202205 if ( style . position ) {
203206 style . removeProperty ( 'position' ) ;
@@ -230,7 +233,7 @@ export class Utils {
230233 }
231234
232235 /** @internal */
233- static updateScrollPosition ( el : HTMLElement , position : { top : number } , distance : number ) {
236+ static updateScrollPosition ( el : HTMLElement , position : { top : number } , distance : number ) : void {
234237 // is widget in view?
235238 let rect = el . getBoundingClientRect ( ) ;
236239 let innerHeightOrClientHeight = ( window . innerHeight || document . documentElement . clientHeight ) ;
0 commit comments