11import React , { useCallback , useRef } from 'react' ;
22
3- import type dxChat from 'devextreme/ui/chat' ;
4- import type { InitializedEvent , Properties as ChatProperties } from 'devextreme/ui/chat' ;
5- import type { ItemClickEvent } from 'devextreme/ui/button_group' ;
6-
73import DataGrid , {
84 Column ,
95 Paging ,
@@ -17,6 +13,9 @@ import DataGrid, {
1713 AIAssistant ,
1814} from 'devextreme-react/data-grid' ;
1915
16+ import type { ChatTypes } from 'devextreme-react/chat' ;
17+ import type { ButtonGroupTypes } from 'devextreme-react/button-group' ;
18+
2019import { sales } from './data.ts' ;
2120import { aiIntegration } from './service.ts' ;
2221
@@ -54,13 +53,13 @@ const suggestions = {
5453} ;
5554
5655export default function App ( ) {
57- const chatRef = useRef < dxChat | null > ( null ) ;
56+ const chatRef = useRef < ChatTypes . InitializedEvent [ 'component' ] | null > ( null ) ;
5857
59- const onChatInitialized = useCallback ( ( e : InitializedEvent ) => {
58+ const onChatInitialized = useCallback ( ( e : ChatTypes . InitializedEvent ) => {
6059 chatRef . current = e . component ?? null ;
6160 } , [ ] ) ;
6261
63- const onSuggestionItemClick = useCallback ( ( e : ItemClickEvent ) => {
62+ const onSuggestionItemClick = useCallback ( ( e : ButtonGroupTypes . ItemClickEvent ) => {
6463 const { prompt, text } = e . itemData ;
6564 const userId = text === '💡 Help' ? 'help' : 'user' ;
6665
@@ -77,7 +76,7 @@ export default function App() {
7776 } ] ) ;
7877 } , [ ] ) ;
7978
80- const chatOptions : ChatProperties = {
79+ const chatOptions : ChatTypes . Properties = {
8180 onInitialized : onChatInitialized ,
8281 user : {
8382 id : 'user' ,
0 commit comments