Skip to content

fix(ai-voice): resolve speech recognition typescript and closure errors - #77

Merged
MistryVishwa merged 1 commit into
MistryVishwa:mainfrom
Mohammad-Hassan027:fix/76-ai-voice-ts-errors
Jul 8, 2026
Merged

fix(ai-voice): resolve speech recognition typescript and closure errors#77
MistryVishwa merged 1 commit into
MistryVishwa:mainfrom
Mohammad-Hassan027:fix/76-ai-voice-ts-errors

Conversation

@Mohammad-Hassan027

Copy link
Copy Markdown
Contributor

Description

This PR resolves the TypeScript compilation failures affecting the Web Speech API implementations across the project, specifically addressing the issues in the AI Voice page.

Changes introduced:

  • Created types/speech-recognition.d.ts as a single, authoritative global ambient declaration for the Web Speech API.
  • Removed conflicting, module-scoped SpeechRecognition interfaces from app/(dashboard)/ai-voice/page.tsx, app/(dashboard)/ai-tutor/page.tsx, and app/(dashboard)/ai-tutor/old-page.tsx which were causing TS2717 clashes.
  • Fixed a stale closure bug (TS2367) in the onend event handler of ai-voice/page.tsx by implementing a voiceStateRef to properly track the live state inside async callbacks.

Related Issue: Closes #76

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (non-breaking change to add/edit documentation)

How Has This Been Tested?

  • TypeScript Compiler: Ran npx tsc --noEmit locally. Verified that all previous SpeechRecognition name/property errors (TS2304, TS2717, TS2339, TS2551) in ai-voice and ai-tutor are fully resolved.
  • State Logic: Verified that the AI Voice page's event listeners correctly reference voiceStateRef.current instead of a stale captured voiceState, allowing the UI to reset properly after speech ends.

Visual Proof (Screenshots/GIFs/Videos):
N/A — This is primarily a type-safety and internal state management fix. No visible UI design changes were made.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings/lint errors
  • I have checked that my branch is up-to-date with main
  • All tests pass locally with my changes

Creates a global ambient declaration file for the Web Speech API to resolve
TS2717 conflicts across multiple pages. Removes duplicate module-scoped
declarations from ai-voice and ai-tutor pages. Fixes a stale closure
bug in the AI Voice page's onend handler by introducing a ref for state.

Closes MistryVishwa#76
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

@Mohammad-Hassan027 is attempting to deploy a commit to the vishwamistrylearning-1037's projects Team on Vercel.

A member of the Team first needs to authorize it.

@MistryVishwa MistryVishwa added bug Something isn't working good first issue Good for newcomers ssoc26 Main tag identifying the repository for Social Summer of Code 2026 Medium 30 Points labels Jul 8, 2026
@MistryVishwa
MistryVishwa merged commit c9bacd5 into MistryVishwa:main Jul 8, 2026
1 of 2 checks passed
@Mohammad-Hassan027
Mohammad-Hassan027 deleted the fix/76-ai-voice-ts-errors branch July 8, 2026 11:34
prasiddhi-105 pushed a commit to prasiddhi-105/edupilot-1 that referenced this pull request Jul 9, 2026
…voice-ts-errors

fix(ai-voice): resolve speech recognition typescript and closure errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working good first issue Good for newcomers Medium 30 Points ssoc26 Main tag identifying the repository for Social Summer of Code 2026

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Fix TypeScript errors in AI Voice speech recognition

2 participants