TS7030: Not all code paths return a value
Problem
Confirm this is a Node library issue and not an underlying OpenAI API issue - [X] This is an issue with the Node library Describe the bug When building using `tsc` with `openai` as a dependency, I get the following error: node_modules/openai/src/lib/AbstractChatCompletionRunner.ts(224,28): error TS7030: Not all code paths return a value. I also had to disable the `noImplicitAny` rule since `openai` is not built, and then my app build inherits your source code basically. To Reproduce `const OpenAI = require('openai');` and build with `tsc` (Ideally, I would like this to be an automated test for this library, so build errors do not repeat.) Code snippets _No response_ OS macOS, ubuntu Node version Node 18 Library version 4.15.1
Error Output
error: node_modules/openai/src/lib/AbstractChatCompletionRunner.ts(224,28): error TS7030: Not all code paths return a value.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: TS7030: Not all code paths return a value
Thanks for reporting. Can you share your tsconfig, and the version of typescript you're using? BTW, be sure you're importing `'openai'`, not `'openai/src'`, in all cases.
Trust Score
1 verification
- 1
Thanks for reporting. Can you share your tsconfig, and the version of typescript
Thanks for reporting. Can you share your tsconfig, and the version of typescript you're using?
- 2
BTW, be sure you're importing `'openai'`, not `'openai/src'`, in all cases.
BTW, be sure you're importing `'openai'`, not `'openai/src'`, in all cases.
Validation
Resolved in openai/openai-node GitHub issue #422. Community reactions: 0 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep