๐Ÿšจ Type โ€˜{โ€ฆ}โ€™ has no properties in common with type โ€˜IntrinsicAttributesโ€™

๐Ÿšจ ์—๋Ÿฌ ๋ฐœ์ƒ

ํ”„๋กœ์ ํŠธ ๊ณผ์ • ์ค‘ _app.tsxํŒŒ์ผ์—์„œ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.

Type '{...}' has no properties in common with type 'IntrinsicAttributes'

image

โ” ์—๋Ÿฌ ์›์ธ

ํ•ด๋‹น ์ปดํฌ๋„ŒํŠธ์˜ props์ธ children์ด ์กด์žฌํ•˜์ง€ ์•Š๋Š”๋‹ค๋Š” ๋œป์ด๋‹ค.

๐Ÿ”จ ์—๋Ÿฌ ํ•ด๊ฒฐ

props๋ฅผ ์„ค์ •ํ•ด์„œ ํƒ€์ž…์„ ์ง€์ •ํ•ด์ฃผ์ž.

import React from "react";

interface Props {
  children?: React.ReactNode;
  [k: string]: any;
}

export default function Layout({ children, ...props }: Props) {
  return <div>Layout</div>;
}

Props๋ฅผ interface๋กœ ์„ค์ •ํ•ด์„œ ํƒ€์ž…์„ ์ง€์ •ํ•˜๊ณ  ์ปดํฌ๋„ŒํŠธ์— ์„ค์ •ํ•ด ์ฃผ์—ˆ๋‹ค.

Leave a comment