microsoft / microsoft/ai-chat-protocol
Issue with context typing
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 177
- Forks
- 27
- Avg merge
- 21d 22h
- Merged PRs (30d)
- 1
Description
Hey @rohit-ganguly I bumped into an issue today because of this typing:
interface AIChatCompletionOptions {
context?: object;
sessionState?: unknown;
}
Because of the object type, you can't index it on arbitrary property as TypeScript reports an error. Some linters like @typescript-eslint reports an error because of this type too.
The same issue also exists with the other context occurrences in AIChatCompletion, AIChatCompletionDelta, AIChatMessage, AIChatMessageDelta.
I recommend updating the type from object to Record<string, unknown> which solves the issues above. This is a common type used in TS for generic indexable objects.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the definitions of AIChatCompletionOptions, AIChatCompletion, AIChatCompletionDelta, AIChatMessage, and AIChatMessageDelta, then inspect each context property. Update the context typing as described and run the project's TypeScript checks or linter to verify that arbitrary property access and the existing protocol types remain valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100