Getting Error Promise is undefined in IE11

后端 未结 7 726
刺人心
刺人心 2020-12-24 11:29

I am converting React code to typescript, target in tsconfig is es5.

on running in IE 11 i get an error \"Promise is undefined\"

I know i need to polyfill,bu

7条回答
  •  粉色の甜心
    2020-12-24 11:39

    Add this script:

    
    

    After that you can test in the console if the Promise is working in IE

    var promise = new Promise(function (resolve, reject) {
    setTimeout(function () {
        resolve('bar');
    }, 1000);
    });
    promise.then(function(result) {
      console.log(result);
    });
    

提交回复
热议问题