Skip to content

Commit c761649

Browse files
fix TS in Vue demos. Editors (strict TS mode) (#31159)
1 parent 20e458f commit c761649

File tree

8 files changed

+19
-12
lines changed

8 files changed

+19
-12
lines changed

apps/demos/Demos/Chat/AIAndChatbotIntegration/Vue/App.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,21 @@ function alertLimitReached(): void {
159159
160160
async function regenerate(): Promise<void> {
161161
toggleDisabledState(true);
162-
162+
const lastMessage = messages.at(-1);
163+
163164
try {
164165
const aiResponse = await getAIResponse(messages.slice(0, -1));
165166
166167
updateLastMessage(aiResponse);
167-
messages.at(-1).content = aiResponse;
168+
169+
if (lastMessage?.content) {
170+
lastMessage.content = aiResponse;
171+
}
168172
} catch {
169-
updateLastMessage(messages.at(-1).content);
173+
if (lastMessage?.content) {
174+
updateLastMessage(lastMessage.content);
175+
}
176+
170177
alertLimitReached();
171178
} finally {
172179
toggleDisabledState(false);

apps/demos/Demos/Chat/AIAndChatbotIntegration/Vue/data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const assistant = {
3838
export const messages: DxChatTypes.Message[] = [];
3939
const store: DxChatTypes.Message[] = [];
4040

41-
const customStore = new CustomStore({
41+
const customStore = new CustomStore<DxChatTypes.Message>({
4242
key: 'id',
4343
load: () => new Promise((resolve) => {
4444
setTimeout(() => {

apps/demos/Demos/Chat/MessageEditing/Vue/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const editingStrategy: Record<string, boolean | ((options: CustomStrategyOptions
112112
enabled: true,
113113
disabled: false,
114114
custom: ({ component, message }: CustomStrategyOptions) => {
115-
if (!component) return;
115+
if (!component) return false;
116116
117117
const { items, user } = component.option();
118118
const userId = user?.id;

apps/demos/Demos/Form/Adaptability/Vue/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import employee from './data.ts';
2929
const calculateColCountAutomatically = ref(false);
3030
3131
const colCountByScreen = computed(() => (calculateColCountAutomatically.value
32-
? null
32+
? undefined
3333
: {
3434
sm: 2,
3535
md: 4,

apps/demos/Demos/Form/Overview/Vue/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const showColon = ref(true);
100100
const minColWidth = ref(300);
101101
const colCount = ref(2);
102102
const companyName = ref(companies[0].Name);
103-
const width = ref(null);
103+
const width = ref();
104104
105105
const company = computed(() => companies.find(({ Name }) => Name === companyName.value));
106106

apps/demos/Demos/Map/Markers/Vue/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ import DxButton from 'devextreme-vue/button';
3636
import { markersData } from './data.ts';
3737
3838
const markerUrl = 'https://js.devexpress.com/Demos/WidgetsGallery/JSDemos/images/maps/map-marker.png';
39-
const markersIcon = ref<string | null>(markerUrl);
39+
const markersIcon = ref<string | undefined>(markerUrl);
4040
const apiKey = {
4141
azure: '6N8zuPkBsnfwniNAJkldM3cUgm3lXg3y9gkIKy59benICnnepK4DJQQJ99AIACYeBjFllM6LAAAgAZMPGFXE',
4242
};
4343
const markers = ref<Record<string, any>[]>(markersData);
4444
function useCustomMarkers(data: DxCheckBoxTypes.ValueChangedEvent) {
45-
markersIcon.value = data.value ? markerUrl : null;
45+
markersIcon.value = data.value ? markerUrl : undefined;
4646
markers.value = markersData;
4747
}
4848
function showTooltips() {

apps/demos/Demos/TextArea/Overview/Vue/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ import DxSelectBox from 'devextreme-vue/select-box';
6767
import service from './data.ts';
6868
6969
const eventValue = ref(service.valueChangeEvents[0].name);
70-
const maxLength = ref<number | null>();
70+
const maxLength = ref<number>();
7171
const value = ref(service.getContent());
7272
const valueForEditableTextArea = ref(service.getContent());
7373
const valueChangeEvents = service.valueChangeEvents;
@@ -77,7 +77,7 @@ const height = ref<number | undefined>(90);
7777
function onCheckboxValueChanged(e: DxCheckBoxTypes.ValueChangedEvent) {
7878
const str = service.getContent();
7979
value.value = e.value ? str.substring(0, 100) : str;
80-
maxLength.value = e.value ? 100 : null;
80+
maxLength.value = e.value ? 100 : undefined;
8181
}
8282
8383
function onAutoResizeChanged(e: DxCheckBoxTypes.ValueChangedEvent) {

apps/demos/tsconfig.vue-check.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "@vue/tsconfig/tsconfig.dom.json",
33
"compilerOptions": {
44
"lib": ["es2023", "DOM", "DOM.Iterable"],
5-
"strict": false
5+
"strict": true
66
},
77
"include": [
88
"Demos/Chat/**/Vue/**/*.vue",

0 commit comments

Comments
 (0)