javascript - Soap request in TypeScript - Stack Overflow

I'm trying to use TypeScript to run a SOAP request, but I'm getting an error when I pile the

I'm trying to use TypeScript to run a SOAP request, but I'm getting an error when I pile 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!

I'm trying to use TypeScript to run a SOAP request, but I'm getting an error when I pile 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!

Share Improve this question asked Jul 15, 2020 at 13:26 Vinicius MocciVinicius Mocci 991 gold badge3 silver badges12 bronze badges 1
  • I'm trying to use this: github./vpulim/node-soap But I'm new to TS, tryin to figure out how to create the same with TypeScript. I've tried with simple node code and worked. – Vinicius Mocci Commented Jul 15, 2020 at 13:43
Add a ment  | 

1 Answer 1

Reset to default 5
import {createClient} from 'soap';

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745568203a4633522.html

相关推荐

  • javascript - Soap request in TypeScript - Stack Overflow

    I'm trying to use TypeScript to run a SOAP request, but I'm getting an error when I pile the

    19小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信