카카오맵 api로 지도 생성시 오류

[FAQ] 지도/로컬 API 문의 전 꼭 읽어 주세요.

카카오맵 api를 사용 하고 있습니다.
현재 제가 이 코드를 작성중인데

import React, { useEffect } from 'react'

interface MapProps {
  width: string;
  height: string;
  initMap?: (map: kakao.maps.Map) => void;
}

function Map({width, height, initMap}: MapProps){
  useEffect(()=>{
    const container = document.getElementById('map');
    const options = {
      center: new kakao.maps.LatLng(37.365264512305174, 127.10676860117488),
      level: 3
    };
    const map = new kakao.maps.Map(container, options);
    if (initMap) {
      initMap(map);
    }
    }, [])


    return (
        <div>
        	<div id="map" style={{ width, height }}></div> 
        </div>
    )
}

export default Map;

여기에서 'kakao’에 'Cannot find namespace ‘kakao’.ts(2304)'와 같은 오류가 뜹니다.
이 파일과 연관된 파일에 경우에도 kakao에 같은 오류가 뜹니다
어떻게 해야 할까요???

kakao 네임스페이스를 찾을 수 없는 오류로 전역으로 kakao 타입을 선언해주세요.

declare global {
    interface Window {
        kakao: any;
    }
}