Skip to content

TeamsSDK: Correct imports and return types in misc. packages#589

Merged
corinagum merged 6 commits into
microsoft:mainfrom
Jesperholmbergmsft:jh/cleanup
May 22, 2026
Merged

TeamsSDK: Correct imports and return types in misc. packages#589
corinagum merged 6 commits into
microsoft:mainfrom
Jesperholmbergmsft:jh/cleanup

Conversation

@Jesperholmbergmsft

@Jesperholmbergmsft Jesperholmbergmsft commented May 21, 2026

Copy link
Copy Markdown
Contributor

This PR is in preparation of adding additional linter rules. There are no functional changes here, but I'm enabling isolatedDeclarations and isolatedModules to a bunch of smaller packages; rearranging imports to favor import as type whenever feasible, and adding return type annotations where missing. This helps reduce build time a smidge and provides better inputs for any tools consuming these libraries - e.g. for tree shaking or transpiling.

How tested:

  • The code builds; linter and unit tests pass
  • I built & packaged the libraries and used them in a separate playground app to make sure it still builds and runs fine.

{
'newlines-between': 'always-and-inside-groups',
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object'],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing 'type' from the list to allow the type imports to be together with the value imports.

'order': 'asc',
'caseInsensitive': true
'caseInsensitive': true,
'orderImportKind': 'ignore',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting orderImportKind: ignore so the thing isn't too opinionated on whether 'import type' comes before 'import'. The imports are still sorted by module path, that should be enough.

'caseInsensitive': true,
'orderImportKind': 'ignore',
},
'sortTypesGroup': false,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So types aren't imported as a separate subgroup.

@Jesperholmbergmsft
Jesperholmbergmsft marked this pull request as ready for review May 21, 2026 23:02
Copilot AI review requested due to automatic review settings May 21, 2026 23:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prepares multiple packages for stricter TypeScript/linting by enabling isolatedDeclarations/isolatedModules, converting eligible imports to import type, and adding explicit return types to satisfy isolated compilation constraints.

Changes:

  • Enable isolatedDeclarations and isolatedModules across several packages’ tsconfig.json.
  • Convert many imports to type-only imports and adjust export style to export type where appropriate.
  • Add/clarify return type annotations on public APIs and class members to support isolated declaration emit.

Reviewed changes

Copilot reviewed 54 out of 54 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/openai/tsconfig.json Enables isolated TS compilation options for the OpenAI package.
packages/openai/src/chat.ts Switches several imports to type-only to support isolated modules/declarations.
packages/openai/src/audio.ts Switches imports to type-only and adds explicit async return types.
packages/graph/tsconfig.json Enables isolated TS compilation options for the Graph package.
packages/graph/src/utils/url.ts Makes ParamDefs a type-only import and adds explicit return type.
packages/graph/src/utils/url.spec.ts Updates test import to type-only.
packages/graph/src/index.ts Adjusts type exports/imports and adds explicit typing for members to satisfy isolated declarations.
packages/graph/src/index.spec.ts Reorders imports and switches to type-only where applicable.
packages/config/eslint.config.js Tweaks eslint config typing and import ordering configuration.
packages/common/tsconfig.json Enables isolated TS compilation options for the Common package.
packages/common/src/storage/local-storage.ts Converts interface import to type-only and adds explicit method return types.
packages/common/src/storage/list-local-storage.ts Converts interface import to type-only.
packages/common/src/logging/string.ts Adds explicit return types to fluent string-builder methods.
packages/common/src/logging/console.ts Converts logger imports to type-only and adds explicit method/utility return types.
packages/common/src/http/token.ts Converts Axios type import to import type.
packages/common/src/http/interceptor.ts Converts Axios/logger imports to type-only.
packages/common/src/http/client.ts Splits axios value vs type imports and adds explicit return types across the client API.
packages/common/src/events/event-emitter.ts Adds explicit types and return annotations to support isolated declaration emit.
packages/client/tsconfig.json Enables isolated TS compilation options for the Client package.
packages/client/src/msal-utils.ts Converts ILogger import to type-only.
packages/client/src/graph-utils.ts Converts ILogger/RequestContext usage to type-only within mixed import.
packages/client/src/app.ts Converts imports to type-only where possible and adds explicit getter return types.
packages/client/src/app.spec.ts Replaces namespace type usage with direct type-only import for MSAL types.
packages/cards/tsconfig.json Enables isolated TS compilation options for the Cards package.
packages/cards/src/actions/submit/task-fetch.ts Converts imports to type-only where possible and adds explicit fluent return types.
packages/cards/src/actions/submit/sign-in.ts Converts imports to type-only where possible and adds explicit fluent return types.
packages/cards/src/actions/submit/message-back.ts Converts imports to type-only where possible and adds explicit return types.
packages/cards/src/actions/submit/invoke.ts Converts imports to type-only where possible and adds explicit fluent return types.
packages/cards/src/actions/submit/im-back.ts Converts imports to type-only where possible and adds explicit fluent return types.
packages/cards/src/actions/submit/collab-stage.ts Splits type vs value imports and adds explicit return types for isolated declarations.
packages/botbuilder/tsconfig.json Enables isolated TS compilation options for the BotBuilder package.
packages/botbuilder/src/plugin.ts Converts some imports to type-only and adds explicit async return types.
packages/botbuilder/src/plugin.spec.ts Converts several imports to type-only to support isolated compilation.
packages/apps/src/types/app-routing.ts Reorders to type-only imports where appropriate.
packages/ai/tsconfig.json Enables isolated TS compilation options for the AI package.
packages/ai/src/templates/string.ts Converts interface import to type-only and adds explicit return type.
packages/ai/src/prompts/index.ts Converts prompt interface imports to type-only.
packages/ai/src/prompts/chat.ts Converts many imports to type-only and adds explicit return types to public members.
packages/ai/src/prompts/chat.spec.ts Converts several imports to type-only for test compilation.
packages/ai/src/prompts/chat-types.ts Converts imports to type-only for declaration friendliness.
packages/ai/src/prompts/audio.ts Converts imports to type-only and adds explicit return types.
packages/ai/src/models/index.ts Converts model interface imports to type-only.
packages/ai/src/models/chat.ts Converts imports to type-only.
packages/ai/src/message.ts Converts imports to type-only.
packages/ai/src/memory.ts Converts imports to type-only.
packages/ai/src/local-memory.ts Converts imports to type-only and adds explicit return types.
packages/ai/src/function.ts Converts schema import to type-only.
examples/mcp-server/src/mcpTools.ts Moves MCP SDK type-only imports to the top for clearer import grouping.
examples/ai-mcp/src/mcp-tools.ts Moves OpenAI type-only import earlier in the file.
examples/ai-mcp/src/local-tools.ts Moves OpenAI type-only import earlier in the file.
examples/ai-mcp/src/agent.ts Moves OpenAI type-only imports earlier in the file.
examples/a2a/src/agent.ts Moves OpenAI type-only imports earlier in the file.
examples/a2a/src/a2a-server.ts Moves A2A SDK type-only imports earlier in the file.
examples/a2a/src/a2a-client.ts Moves A2A SDK type-only imports earlier in the file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/common/src/logging/string.ts Outdated
Comment thread packages/graph/src/index.ts
Comment thread packages/botbuilder/src/plugin.ts Outdated
Comment thread packages/openai/src/audio.ts Outdated
Comment thread packages/botbuilder/src/plugin.ts
Comment thread packages/openai/src/chat.ts Outdated

@corinagum corinagum left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! just some nits & 1 question. lmk when ready, happy to re-stamp :)

@corinagum
corinagum merged commit 1657313 into microsoft:main May 22, 2026
4 checks passed
@Jesperholmbergmsft
Jesperholmbergmsft deleted the jh/cleanup branch May 22, 2026 22:33
corinagum added a commit that referenced this pull request May 27, 2026
## Summary

Brings `origin/main` into `release` for the **2.0.12** release. **No
carve-outs this time** — Quoted Replies is included.

`version.json`: `2.0.12-preview.{height}` → `2.0.12`.

Aligns with teams.py 2.0.12 (PR #442 already on PyPI / pending publish).

## What's in this release (delta from 2.0.11)

**Features**
- Quoted Replies + new quotes features — previously held back via the
2.0.11 carve-out (#576)
- SuggestedActionSubmitActivity for `suggestedAction/submit` invoke
(#591)
- Default targeted replies for targeted inbound messages (#592)
- Filter colliding keys before `Object.assign` in `ActivityContext`
(#596)
- Prompt Preview support (#536)
- A2A sample (#584)
- AI/MCPClient (#572)
- Allow passing custom HTTP client via `AppOptions`-equivalent
- Reactions API marked GA (#575), Rename `ReactionClient.remove()` →
`delete()` (#567)

**Security & fixes**
- Security hardening: tighten cross-origin policies (#595)
- Lock JsonWebToken trust-boundary contract (#586)
- `fix(deps)`: npm audit fix — clears all high-severity advisories
(#599)
- `fix(apps)`: log inbound activities at info, warn on missing
Authorization (#568)
- `fix`: App user-agent merging (#573)
- `fix`: Add null checks in `local-memory.ts` to prevent role crash
(#438)
- `fix`: `@microsoft/teams.client` import error in webpack 5 (#566)
- Switch to named imports without subpaths (#561)

**Deprecations / package changes**
- Deprecate `DevtoolsPlugin` in favor of Microsoft 365 Agents Playground
(#593)
- Remove in-repo Teams CLI package (#580) — moved to
`teams-sdk/packages/cli`
- Deprecate AI Libraries (#588)
- Correct imports + return types in misc. packages (#589)

**Dependency bumps**
- turbo 2.8.11 → 2.9.14 (#587)
- qs 6.15.0 → 6.15.2 (#594)
- hono 4.12.14 → 4.12.16 (#562)
- npm audit fix bundle (#599): axios 1.13.5 → 1.16.1, fast-uri 3.1.0 →
3.1.2, ws 8.19.0 → 8.21.0, @azure/msal-node hoisted 5.2.2, uuid 11.1.0 →
11.1.1, @azure/identity 4.13.0 → 4.13.1, express-rate-limit, ip-address,
brace-expansion, etc.

## Quoted Replies inclusion notes

- Teams client rendering is in-sync with the wire format as of
2026-05-06.
- APX QR rollout completed: Public 2026-04-10, GCCH/DoD/Gallatin
2026-04-14.
- No SDK-side carve-outs needed; this matches the teams.py 2.0.12 (PR
#442) decision.

## Branch structure note

`prep-release/2.0.12` is reset to `origin/main` + a one-line
`version.json` bump. Diff against `release` (this PR) shows the full
delta from 2.0.11. We deliberately did not use a 2-parent merge commit —
the auto-merge tried to interleave non-overlapping hunks from main's QR
additions with release's QR carve-outs in `activity.ts`, producing a
semantically broken file. Reset-to-main + version bump is the clean way
to express "release should equal main."

## Test plan

- [x] `npm install` clean (post-audit-fix lockfile)
- [x] `npm run build` — 33/33 targets clean
- [x] `npm test` — 14/14 task targets, 279+ tests pass
- [x] E2E echo bot smoke test against `cg-test-bot-py` via canary ABS —
done on `cg/audit-deps-ts` (now merged); covers axios + msal-node code
paths
- [ ] Pipeline Build + Test stages green on `release` after merge
- [ ] Publish pipeline run with **Public** → ESRP → npm
`@microsoft/teams.*@2.0.12`
- [ ] Smoke install: `npm view @microsoft/teams[email protected]` after
publish
corinagum added a commit that referenced this pull request Jun 15, 2026
## Release 2.0.13

Merges main into release for stable publish.

### Notable changes since 2.0.12
- fix(client): use explicit Graph scopes for Teams Desktop NAA
compatibility (#616)
- ci: switch publish pipeline to 1ES Official template for CodeQL/SDL
(#607)
- ci: add weekly SDL pipeline for CodeQL/CredScan compliance (#608)
- Refresh teams.apps README (#604)
- Reject unauthenticated when no credentials (#506)
- fix(api): conditionally set citation encodingFormat based on text
presence (#579)
- Improvements to the Teams MCP server example (#597)
- Bump MSAL Node to v5 (#603)
- Merge root message entities in Activity (#590)
- TeamsSDK: Correct imports and return types in misc. packages (#589)
- Cache federated identity MSAL clients (#613)

### Release steps
1. Merge this PR
2. Trigger the [release
pipeline](https://dev.azure.com/DomoreexpGithub/Github_Pipelines/_build?definitionId=52&_a=summary)
for `release` branch with **Public** publish type
3. Bump version on main to `2.0.14-preview.{height}`
4. Create git tag and GitHub Release page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants