TypeScript에게 무엇인지 설명해주는 시간이다.

object 에게 type을 설명해주는 시간이 필요하다.
interface 안에 설명해준다.

그 후

bhColor 의 타입이 CircleProps 즉, string 이라는 것을 써주면 된다.
Circle
 import styled from "styled-components";
interface ContainerProps {
  bgColor: string;
}
const Container = styled.div<ContainerProps>`
  width: 500px;
  height: 500px;
  background-color: ${(props) => props.bgColor};
`;
interface CircleProps {
  bgColor: string;
}
function Circle({ bgColor }: CircleProps) {
  return <Container bgColor={bgColor} />;
}
export default Circle;App
 import styled from "styled-components";
import Circle from "./Circle";
const Father = styled.div`
  display: flex;
`;
const Wrapper = styled.div`
  width: 100vw;
  height: 100vh;
  border: 1px solid red;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: ${(props) => props.theme.backgrouondColor};
`;
const Box = styled.div`
  color: ${(props) => props.theme.textColor};
`;
export default function App() {
  return (
    <div>
      <Circle bgColor="teal" />
      <Circle bgColor="tomato" />
    </div>
  );
}
 배운 것
- interface를 활용하여 Object를 보호하는 법
  
이제 어디서든 sayHello 를 사용할 수 있다.
- 코드 실행 전에 error를 볼 수 있다.
+) 조금 더 깔끔하게 하고 싶다면
  
CircleProps로 통일하면 된다.