Commit ab05e4c
Nathan Young
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 48cf4a2 commit ab05e4c
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 | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
362 | 358 | | |
363 | 359 | | |
364 | 360 | | |
| |||
686 | 682 | | |
687 | 683 | | |
688 | 684 | | |
689 | | - | |
690 | | - | |
691 | | - | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
692 | 688 | | |
693 | | - | |
| 689 | + | |
694 | 690 | | |
695 | 691 | | |
696 | 692 | | |
697 | 693 | | |
698 | 694 | | |
699 | | - | |
700 | | - | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
701 | 700 | | |
702 | 701 | | |
703 | 702 | | |
| |||
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