microsoft / teams-ai

SDK focused on building AI based applications and extensions for Microsoft Teams and other Bot Framework channels
MIT License
430 stars 185 forks source link

[Dev support]: Unable to build TS project with typescript < 5.3.0 #2050

Open blackchoey opened 1 month ago

blackchoey commented 1 month ago

Question

Right now projects using typescript < 5.3.0 will meet build failure if the project references Teams-AI library. Seems the recent MSAL-JS library release causes this issue. However, the botbuilder sdk does not have similar build failures, though it also references MSAL.

Though higher typescript version seems be able to fix the build errors. I'm raising this question to see whether some changes (e.g. tsconfig, etc.) are required in Teams-AI to avoid such kind of errors, so users with lower typescript version (like an existing project developed earlier) won't meet the error.

Here're the sample error message:

> echobot-demo@1.0.0 build
> tsc --build

node_modules/@azure/msal-common/lib/types/broker/nativeBroker/INativeBrokerPlugin.d.ts:1:23 - error TS1452: 'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`.

...

  And here're the repro steps:

  1. Copy the JS echo bot sample out of the repo
  2. Change the typescript version to an older one like 5.2.2
  3. Run npm install and npm run build command under the echo bot project's root folder. You will see the build failure.

Code snippets

N/A

What you have tried already

Here're current observations:

  1. MSAL changes moduleResolution and module compiler options to nodenext
  2. Starting from TypesScript 5.3.0, resolution-mode supported in all module modes which seems solved the issue from compiler perspective. https://devblogs.microsoft.com/typescript/announcing-typescript-5-3/
  3. There is no similar issue for bot built with botbuilder packages. We haven't found why there's no problem with botbuilder.

Note: please use this template to file your questions regarding implementation. Once your question is answered, our team will move this question to Q&A in Discussions for findability.

corinagum commented 1 month ago

Hey @blackchoey, thanks for the FYI. To note, I have a PR that will be updating our tsconfigs to ESNext: https://github.com/microsoft/teams-ai/pull/2034 (I hadn't realized that we weren't using ESNext in the samples).

With these changes I'll test out echobot and get back to you.