Commit 6858973
committed
refactor: use typed Part interface instead of any casts
Per review feedback: use the @google/genai typed `Part` interface
directly instead of `as any` casts.
- Read side: `part.thoughtSignature` is properly typed on `Part`, so
the cast is removed entirely. The Gemini 2.x fallback to
`functionCall.thoughtSignature` is also removed since the SDK has
never typed it there and Gemini has always emitted it at Part level.
- Write side: construct a typed `Part` and conditionally assign
`thoughtSignature`, avoiding the `as Part` cast on a spread literal.
The only remaining `as any` in this area is the pre-existing
functionResponse cast, which is unrelated to this fix.1 parent 01814f3 commit 6858973
3 files changed
Lines changed: 24 additions & 26 deletions
File tree
- .changeset
- packages/typescript/ai-gemini
- src/adapters
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
396 | 392 | | |
397 | 393 | | |
398 | 394 | | |
| |||
720 | 716 | | |
721 | 717 | | |
722 | 718 | | |
723 | | - | |
724 | | - | |
725 | | - | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
726 | 722 | | |
727 | | - | |
| 723 | + | |
728 | 724 | | |
729 | 725 | | |
730 | 726 | | |
731 | 727 | | |
732 | 728 | | |
733 | | - | |
734 | | - | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
735 | 734 | | |
736 | 735 | | |
737 | 736 | | |
| |||
Lines changed: 7 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
592 | 592 | | |
593 | 593 | | |
594 | 594 | | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
599 | 598 | | |
600 | 599 | | |
601 | 600 | | |
| |||
604 | 603 | | |
605 | 604 | | |
606 | 605 | | |
607 | | - | |
| 606 | + | |
608 | 607 | | |
609 | 608 | | |
610 | | - | |
| 609 | + | |
611 | 610 | | |
612 | 611 | | |
613 | 612 | | |
| |||
671 | 670 | | |
672 | 671 | | |
673 | 672 | | |
674 | | - | |
675 | | - | |
| 673 | + | |
| 674 | + | |
676 | 675 | | |
677 | 676 | | |
678 | 677 | | |
| |||
0 commit comments