@@ -2,7 +2,9 @@ import type { ToastProps } from '@blueprintjs/core';
22import type { SerializedStyles } from '@emotion/react' ;
33import type {
44 JpathTableColumn ,
5+ SerializedNmriumState ,
56 SpectraTableColumn ,
7+ Spectrum1D ,
68} from '@zakodium/nmrium-core' ;
79import { BlobWriter , TextReader , ZipWriter } from '@zip.js/zip.js' ;
810import dlv from 'dlv' ;
@@ -23,14 +25,14 @@ export const browserNotSupportedErrorToast: ToastProps = {
2325 * @param isCompressed
2426 */
2527async function exportAsJsonBlob (
26- data : any ,
28+ data : SerializedNmriumState ,
2729 fileName = 'experiment' ,
2830 spaceIndent = 0 ,
2931 isCompressed = false ,
3032) {
3133 const fileData = JSON . stringify (
3234 data ,
33- ( key , value : any ) =>
35+ ( key , value : unknown ) =>
3436 ArrayBuffer . isView ( value ) ? Array . from ( value as any ) : value ,
3537 spaceIndent ,
3638 ) ;
@@ -44,11 +46,10 @@ async function exportAsJsonBlob(
4446}
4547
4648function exportAsMatrix (
47- data : any ,
49+ data : Spectrum1D [ ] ,
4850 spectraColumns : SpectraTableColumn [ ] ,
4951 name : string ,
5052) {
51- //columns labels
5253 const columnsLabels : string [ ] = [ ] ;
5354 // listed the spectra panel columns
5455 for ( const col of spectraColumns ) {
@@ -58,7 +59,7 @@ function exportAsMatrix(
5859 }
5960
6061 for ( const value of data [ 0 ] . data . x ) {
61- columnsLabels . push ( value ) ;
62+ columnsLabels . push ( String ( value ) ) ;
6263 }
6364 let matrix = `${ columnsLabels . join ( '\t' ) } \n` ;
6465
@@ -76,7 +77,7 @@ function exportAsMatrix(
7677 }
7778 }
7879 for ( const value of re ) {
79- cellsValues . push ( value ) ;
80+ cellsValues . push ( String ( value ) ) ;
8081 }
8182 matrix += `${ cellsValues . join ( '\t' ) } \n` ;
8283 }
@@ -289,7 +290,7 @@ function transferToCanvas(offscreenCanvas: OffscreenCanvas) {
289290// hack way to copy the image to the clipboard
290291// TODO: remove when Firefox widely supports ClipboardItem
291292// https://caniuse.com/mdn-api_clipboarditem
292- function copyDataURLClipboardFireFox ( image : any ) {
293+ function copyDataURLClipboardFireFox ( image : string ) {
293294 const img = document . createElement ( 'img' ) ;
294295 img . src = image ;
295296
@@ -397,13 +398,13 @@ function parseDimension(value: string | null) {
397398
398399function getBlob ( targetElementID : string , options : GetBlobOptions ) : BlobObject {
399400 const { rootElement, css } = options ;
400- const _svg : any = ( rootElement . getRootNode ( ) as Document )
401+ const _svg = ( rootElement . getRootNode ( ) as Document )
401402 . querySelector ( `#${ targetElementID } ` )
402- ?. cloneNode ( true ) ;
403+ ?. cloneNode ( true ) as SVGElement ;
403404
404- const width = parseDimension ( _svg ? .getAttribute ( 'width' ) ) ;
405- const height = parseDimension ( _svg ? .getAttribute ( 'height' ) ) ;
406- const viewBox = _svg ? .getAttribute ( 'viewBox' ) || `0 0 ${ width } ${ height } ` ;
405+ const width = parseDimension ( _svg . getAttribute ( 'width' ) ) ;
406+ const height = parseDimension ( _svg . getAttribute ( 'height' ) ) ;
407+ const viewBox = _svg . getAttribute ( 'viewBox' ) || `0 0 ${ width } ${ height } ` ;
407408
408409 for ( const element of _svg . querySelectorAll ( '[data-no-export="true"]' ) ) {
409410 element . remove ( ) ;
0 commit comments