test(web): typecheck core test files in the typecheck script (#1043)
Description
Closes #1043.
packages/core/tsconfig.json excludes **/*.test.ts. The config that covers the tests, tsconfig.test.json, was only used as an ESLint parser project, so type errors in the Web test files were never reported.
packages/coretypecheckis nowtsc --noEmit && tsc -p tsconfig.test.json --noEmit, the same shape as the RN core package. The rootbindings/webtypecheckalready runs it, so theweb-typecheckjob inpr-build.ymlpicks it up with no workflow change.tsconfig.test.jsonnow excludes**/*.test-d.ts. That file belongs to tsd (test:types). It imports@runanywhere/webthroughdist/, which the root script only builds after the core typecheck.- Fixed the errors the config reports, all in test fakes and fixtures. No
src/changes:RunAnywhere+TTSLifecycle,RunAnywhere+VADStream: the fake moduleinterfaceextended bothEmscriptenRunanywhereModuleandModalityProtoModule, whose shared members differ inreadonlyand optionality (TS2320). They now use the intersection-type andPartial+installCurrentModelRegistryExports(...)pattern thatRunAnywhere+VADLifecyclealready uses. This also covers the_rac_solution_*,getValue/setValueand registry members the literals omit.RunAnywhere+TextGenerationStream: same TS2320. The fake only goes toModalityProtoAdapter.registerModuleCapabilities, so it now extendsModalityProtoModuleonly.resolveSecondTokenwas narrowed tonulland then called (TS2349).RunAnywhere+CrossWasmModelLifecycle: the module literal omitted the required_rac_solution_*and model-registry members. It is now typed asPartial<...>.runtime/EmscriptenModule: the fake was missing the requiredgetValueandsetValue.RunAnywhere+ToolCalling:addFunction'snever[]callback type could not be stored in itsMap, andstringToUTF8returnedundefinedinstead ofnumber.RunAnywhere+StructuredOutput: twoStructuredOutputValidationliterals were missingrepairAttemptedandrepairAttempts.RunAnywhere+STTLifecycle:_rac_audio_float32_to_pcm16was not declared on the fake module type.RunAnywhere+CrossWasmRAG:ragQueryStreamis optional onRAGProviderand was called without a guard.
Type of Change
- Bug fix
- New feature
- Documentation update
- Refactoring
Testing
- Lint passes locally
- Added/updated tests for changes
Ran in bindings/web: npm run typecheck (includes tsc -p packages/core/tsconfig.test.json --noEmit), npm run lint, npm test.
Platform-Specific Testing (check all that apply)
Swift SDK / iOS Sample:
- Tested on iPhone (Simulator or Device)
- Tested on iPad / Tablet
- Tested on Mac (macOS target)
Kotlin SDK / Android Sample:
- Tested on Android Phone (Emulator or Device)
- Tested on Android Tablet
Flutter SDK / Flutter Sample:
- Tested on iOS
- Tested on Android
React Native SDK / React Native Sample:
- Tested on iOS
- Tested on Android
Web SDK / Web Sample:
- Tested in Chrome (Desktop)
- Tested in Firefox
- Tested in Safari
- WASM backends load (LlamaCpp + ONNX)
- OPFS storage persistence verified (survives page refresh)
- Settings persistence verified (localStorage)
Labels
Please add the appropriate label(s):
SDKs:
-
Swift SDK- Changes to Swift SDK (bindings/swift) -
Kotlin SDK- Changes to Kotlin SDK (bindings/kotlin) -
Flutter SDK- Changes to Flutter SDK (bindings/flutter) -
React Native SDK- Changes to React Native SDK (bindings/react-native) -
Web SDK- Changes to Web SDK (bindings/web) -
Commons- Changes to shared native code (core)
Sample Apps:
-
Flutter Sample- Changes to Flutter example app (bindings/flutter/example) -
React Native Sample- Changes to React Native example app (bindings/react-native/example) -
Minimal Examples- Changes to an in-repo SDK harness (bindings/{swift,kotlin,web}/example)
Checklist
- Code follows project style guidelines
- Self-review completed
- Documentation updated (if needed)
Screenshots
N/A
Summary by cubic
Makes packages/core typechecking cover test files, so type errors in them are now reported instead of silently passing. Fixes the type errors the config now surfaces, all in test fakes and fixtures; no src/ changes.
typechecknow runstsc --noEmitplustsc -p tsconfig.test.json --noEmit, and the rootbindings/webscript already runs it, so the CI workflow picks it up without changes.tsconfig.test.jsonexcludes**/*.test-d.ts, which belongs totest:typesand imports throughdist/.- Test fakes were updated to match the real module shapes: intersection types instead of duplicate
interfaceextensions,Partialwrappers plusinstallCurrentModelRegistryExports, and missing members (getValue/setValue,_rac_audio_float32_to_pcm16,repairAttempted,repairAttempts) added or narrowed.
Summary by CodeRabbit
-
Tests
- Updated test fixtures and type definitions across model lifecycle, streaming, speech, retrieval, structured output, and tool-calling scenarios.
- Expanded runtime test mocks to cover additional module behavior and validation metadata.
-
Chores
- Extended TypeScript checks to include the test project and exclude declaration test files.