const {
currentBuild,
updateComponent,
addStorageComponent,
removeStorageComponent,
addCaseFan,
removeCaseFan,
addRamComponents,//Property 'addRamComponents' does not exist on type 'BuilderStore'.ts(2339)
removeRamComponents,//Property 'removeRamComponents' does not exist on type 'BuilderStore'.ts(2339)
clearBuild,
getTotalPrice,
checkCompatibility,
canUseStockCooler,
useStockCooler,
} = useBuilderStore();
const { addItem } = useCartStore();
< /code>
Я получаю эту ошибку, но в Builderstore.s я определил функцию: < /p>
interface BuilderStore {
currentBuild: PCBuild;
savedBuilds: PCBuild[];
updateComponent: (category: keyof PCBuild, component: BuildComponent | undefined) => void;
addStorageComponent: (component: BuildComponent) => void;
removeStorageComponent: (index: number) => void;
addRamComponents: (component: BuildComponent) => void;
removeRamComponents: (index: number) => void;
addCaseFan: (component: BuildComponent) => void;
removeCaseFan: (index: number) => void;
clearBuild: () => void;
saveBuild: () => void;
getTotalPrice: () => number;
checkCompatibility: () => string[];
canUseStockCooler: () => boolean;
useStockCooler: () => void;
}
Я делаю что -то не так, или это какая -то странная ошибка кодирования
Я попытался переименовать функцию, перезагруженный силой, очищенный кэш, ничто не исправлено. /> export const useBuilderStore = create < BuilderStore > ()(
persist(
(set, get) => ({
currentBuild: {},
savedBuilds: [],
.......
addCaseFan: (component) =>
set((state) => ({
currentBuild: {
...state.currentBuild,
caseFans: [...(state.currentBuild.caseFans || []), component],
},
})),
removeCaseFan: (index) =>
set((state) => ({
currentBuild: {
...state.currentBuild,
caseFans: state.currentBuild.caseFans?.filter((_, i) => i !== index) || [],
},
})),
addRamComponents: (component) =>
set((state) => ({
currentBuild: {
...state.currentBuild,
ram: [...(state.currentBuild.ram || []), component],
},
})),
removeRamComponents: (index) =>
set((state) => ({
currentBuild: {
...state.currentBuild,
ram: state.currentBuild.ram?.filter((_, i) => i !== index) || [],
},
})),
clearBuild: () =>
set({
currentBuild: {}
}),
saveBuild: () =>
set((state) => ({
savedBuilds: [...state.savedBuilds, state.currentBuild],
})),
Подробнее здесь: https://stackoverflow.com/questions/796 ... rly-exists
Функция не существует ошибки, но она явно существует ⇐ Javascript
Форум по Javascript
-
Anonymous
1751641312
Anonymous
const {
currentBuild,
updateComponent,
addStorageComponent,
removeStorageComponent,
addCaseFan,
removeCaseFan,
addRamComponents,//Property 'addRamComponents' does not exist on type 'BuilderStore'.ts(2339)
removeRamComponents,//Property 'removeRamComponents' does not exist on type 'BuilderStore'.ts(2339)
clearBuild,
getTotalPrice,
checkCompatibility,
canUseStockCooler,
useStockCooler,
} = useBuilderStore();
const { addItem } = useCartStore();
< /code>
Я получаю эту ошибку, но в Builderstore.s я определил функцию: < /p>
interface BuilderStore {
currentBuild: PCBuild;
savedBuilds: PCBuild[];
updateComponent: (category: keyof PCBuild, component: BuildComponent | undefined) => void;
addStorageComponent: (component: BuildComponent) => void;
removeStorageComponent: (index: number) => void;
addRamComponents: (component: BuildComponent) => void;
removeRamComponents: (index: number) => void;
addCaseFan: (component: BuildComponent) => void;
removeCaseFan: (index: number) => void;
clearBuild: () => void;
saveBuild: () => void;
getTotalPrice: () => number;
checkCompatibility: () => string[];
canUseStockCooler: () => boolean;
useStockCooler: () => void;
}
Я делаю что -то не так, или это какая -то странная ошибка кодирования
Я попытался переименовать функцию, перезагруженный силой, очищенный кэш, ничто не исправлено. /> export const useBuilderStore = create < BuilderStore > ()(
persist(
(set, get) => ({
currentBuild: {},
savedBuilds: [],
.......
addCaseFan: (component) =>
set((state) => ({
currentBuild: {
...state.currentBuild,
caseFans: [...(state.currentBuild.caseFans || []), component],
},
})),
removeCaseFan: (index) =>
set((state) => ({
currentBuild: {
...state.currentBuild,
caseFans: state.currentBuild.caseFans?.filter((_, i) => i !== index) || [],
},
})),
addRamComponents: (component) =>
set((state) => ({
currentBuild: {
...state.currentBuild,
ram: [...(state.currentBuild.ram || []), component],
},
})),
removeRamComponents: (index) =>
set((state) => ({
currentBuild: {
...state.currentBuild,
ram: state.currentBuild.ram?.filter((_, i) => i !== index) || [],
},
})),
clearBuild: () =>
set({
currentBuild: {}
}),
saveBuild: () =>
set((state) => ({
savedBuilds: [...state.savedBuilds, state.currentBuild],
})),
Подробнее здесь: [url]https://stackoverflow.com/questions/79690300/function-does-not-exist-error-but-it-clearly-exists[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия