Intellisense 抱怨它找不到命名空間WorkorderListContext作為WorkorderListProvider回報,但它在同一個檔案中?
import { createContext } from 'react';
interface IWorkorderListContext {
items: any[];
setItems?: (itemsArray: []) => void;
getItems?: () => [];
}
const defaultState = {
items: []
};
const WorkorderListContext = createContext<IWorkorderListContext>(defaultState);
const WorkorderListProvider = ({ children }: { children: any }) => {
return (
<WorkorderListContext.Provider> **<---- Error: Cannot find namespace ts(2503)**
{children}
</WorkorderListContext.Provider>
)
}
export { WorkorderListProvider, WorkorderListContext };
uj5u.com熱心網友回復:
您應該使用.tsx檔案的兼容格式
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/364358.html
