Typescript types are incomplete for @jsreport/browser-client



  • When using jsreport web client with TypeScript, the following errors are reported. Please consider expanding the type definitions to at least account for setting serverUrl and headers

    jsreport.serverUrl = 'https://XXX.jsreportonline.net'
    jsreport.headers['Authorization'] = "Basic " + Buffer.from("XXX:XXX").toString('base64');
    

    TS2339: Property 'serverUrl' does not exist on type 'JsReportClient'.

    TS7053: Element implicitly has an 'any' type because expression of type '"Authorization"' can't be used to index type '{}'.   Property 'Authorization' does not exist on type '{}'.

    Currently a workaround is to break type safety:

    const jsReport:any = jsreport;
    jsReport.serverUrl = 'https://XXX.jsreportonline.net'
    jsReport.headers['Authorization'] = "Basic " + Buffer.from("XXX:XXX").toString('base64');
    

Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.