2

Promise.prototype.finally has been part of the ECMAScript specification for more than a year and gives no errors in most browsers.

When used within Teams desktop app, I see "Promise.prototype.finally() is not a function" error in console. Is there any documentation available on what can be used within a Teams app?

I can polyfill this function but wished to know about documentation on any other quirks or support on what to use?

Why is this issue caused in Teams desktop app and not the Teams web app?

Ashutosh
  • 1,000
  • 15
  • 39

3 Answers3

3

Even if Microsoft Teams got ES6 Promises working in desktop client it doesn't matter because Teams needs to run on IE11 which doesn't support them. There are a multiple of options available here.

  1. Use Babel to transpile JavaScript from ES6 and ES7 down to ES5:

    How do I get Babel 6 to compile to ES5 javascript?

  2. Use TypeScript and target ES5 when compiling:

    Typescript- What is target in tsconfig?

  3. Use one of the many available polyfills:

    https://ourcodeworld.com/articles/read/316/top-5-best-javascript-promises-polyfills

Wajeed Shaikh
  • 3,078
  • 1
  • 23
  • 30
  • 4
    I thought Microsoft officially stopped supporting IE11, how come you guys are targeting it for applications? – Madara's Ghost Mar 26 '19 at 08:33
  • 2
    [This answer is being discussed on meta.](https://meta.stackoverflow.com/questions/381826/speaking-for-a-company-in-first-person) – Script47 Mar 26 '19 at 09:03
  • As ES5 is a old version, is there any timeline on when I can use ES6/ES7 with Teams? This question was intended to understand which JS engine was used within Teams. Can you shed light on that? – Ashutosh Mar 26 '19 at 19:05
3

To answer the "why" question, Microsoft Teams uses Electron 1.7.1 (according to the ThirdPartyNotice.txt file located next to Teams.exe) and Promise.prototype.finally was added only in Electron 3.x.

dee-see
  • 23,668
  • 5
  • 58
  • 91
0

To add to Wajeed's answer, you could also use add a polyfill CDN which only downloads the polyfills required for the browser the user is using (of course based on a list of features that you as a developer are marking as required for your application to run): https://cdn.polyfill.io/v3/

You can check whether your feature is supported by which browser in can i use: https://caniuse.com/promise

Patrick
  • 179
  • 1
  • 8