Skip to content

Fix type errors in the published typings with skipLibCheck turned off - #5978

Merged
Eugene (OEvgeny) merged 9 commits into
mainfrom
OEvgeny/fix-shipped-typings
Oct 29, 2026
Merged

Eugene (OEvgeny) merged 9 commits into
mainfrom
OEvgeny/fix-shipped-typings

Conversation

@OEvgeny

@OEvgeny Eugene (OEvgeny) commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

TypeScript projects that type-check our published typings (skipLibCheck: false) get up to 19 errors from Web Chat's own declarations.

Changelog Entry

Fixed

  • Fixed type errors in the published typings when skipLibCheck is turned off, in PR #5978, by @OEvgeny

Description

The typings had type-only members emitted as values in namespaces, a self-referencing renderMarkdown.createStreamingRenderer, non-DOM globals, and 2 constraints failing under strict. JavaScript output only changes by the renamed function.

Design

  • Types leave the export * as namespaces instead of getting local aliases: they never worked as types there; entry points still export them.
  • Non-DOM globals resolve through globalThis, instead of adding @types/dom-speech-recognition and @types/node to dependencies.

Specific Changes

  • bundle/src/boot: types exported by exports/*.ts, not actual/*
  • renderMarkdown.ts, createMarkdownStreamingRenderer.ts: file and function renamed to createMarkdownStreamingRenderer
  • WebSpeechPonyfill.ts, GlobalScopeClock.ts: globals via new base TypeOfGlobal
  • templateDecorator.tsx, component ContextOf.ts: constraints no longer invariant
  • No new test: each package alone, React 16/18 types: 0 errors from our declarations (React 19: prop-types TS7016, fixed by Remove propTypes statics that break typings with @types/react@19 #5973)
  • Not fixed (dependencies): NetworkInformation (botframework-directlinejs), Buffer (@types/node@10 via botframework-streaming), type-fest (undeclared by react-chain-of-responsibility)
  • I have added tests and executed them locally
  • I have added .changelog/<PR#>-<slug>.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

Eugene Olonov added 7 commits October 28, 2026 14:33
@types/dom-speech-recognition is a devDependency of botframework-webchat-api, so consumers type-checking our declarations (skipLibCheck: false) got TS2304 for SpeechGrammarList and SpeechRecognition.
InferMiddleware/InferProps/InferRequest of templateDecorator and the component's ContextOf constrained on types that are invariant (ComponentType, Context), so their use in our declarations failed with TS2344 for consumers with strict: true.
Our typings bundler emits a type imported from another package as `declare const X: typeof X` inside `export * as` namespaces (decorator, internal, Components, hooks), which fails with TS2693 when consumers type-check our declarations. These namespace members were never usable as types and do not exist at runtime. The entry points (decorator.js, internal.js, component.js, hook.js) still export the same types.
…encing typing

The expando `render.createStreamingRenderer = createStreamingRenderer` emitted `var createStreamingRenderer: typeof createStreamingRenderer` inside `declare namespace render`, which refers to itself (TS2502).
…hared TypeOfGlobal type

GlobalScopeClock used typeof setImmediate/clearImmediate, which are Node.js globals: consumers with only TypeScript's DOM library got "Cannot find name" in core's typings. TypeOfGlobal<Name, Fallback> in @msinternal/botframework-webchat-base (inlined in each package's typings) replaces the lookup duplicated in WebSpeechPonyfill.
…e.js types

TypeOfGlobal's never default turned GlobalScopeClock's setImmediate/clearImmediate into undefined/never for consumers without @types/node, breaking ponyfill options and calls that compiled on main. Pass the types declared in env.d.ts as fallbacks and require a fallback at every call site.
@OEvgeny
Eugene (OEvgeny) marked this pull request as ready for review October 28, 2026 23:08
Copilot AI balanced review requested due to automatic review settings October 28, 2026 23:08

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@compulim William Wong (compulim) 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.

Nitpick.

@OEvgeny
Eugene (OEvgeny) merged commit a19f7f2 into main Oct 29, 2026
33 checks passed
@OEvgeny
Eugene (OEvgeny) deleted the OEvgeny/fix-shipped-typings branch October 29, 2026 00:28
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