What is the Typescript type for AbortController?

Viewed 60

I can't find any reference about how to define the type for AbortController. I am using it in a React component like so:

    const abortController = useRef();
    
    const doRequest = () => {
            abortController.current = new AbortController();
            window
                .fetch(url, {
                    method: 'GET',
                    signal: abortController.current.signal,
                })
                .then(res => res.json());
        };

const cancelRequest = () => {
  abortController.current.abort();
};
0 Answers
Related