Soap request in TypeScript

Viewed 1632

I'm trying to use TypeScript to run a SOAP request, but I'm getting an error when I compile the code with "tsc myfile.ts". The code:

import Soap from 'soap';

function soapClientServer(){
    
const url = 'myurl'

Soap.createClient(url, function(err, client){
if(err){
    console.log(err)
}else{
    console.log('connection with SOAP OK')
    client.consultaNFSe({
      token: 'mytoken',
      cnpj: 'mydata',
      nrNota: '',
      nrPedido: 'mydata'
    }, (err, res) =>{
        return console.log(res)
    })
  }
})

}

export default soapClientServer()

The error:

index.ts:1:8 - error TS1192: Module '"/Users/vinicius.siqueira/Projects/MyPC/soap-typescript/node_modules/soap/lib/soap"' has no default export.

1 import Soap from 'soap';
         ~~~~


Found 1 error.

Any ideas? Thanks!

1 Answers
import {createClient} from 'soap';
Related