Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I cant find my context provider namespace?

Intellisense complains that it can’t find the namespace WorkorderListContext in WorkorderListProvider return, but its in the same file?

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 };

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You should use .tsx as compatible format of the file

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading