codestates / codestates/Campbu

[Err Log] Typescript에서 emotion 사용시 발생된 error (etc)/2022-01-03

Open
#46 0 comments 0 reactions 0 assignees View on GitHub
Err Log
Dominant language
TypeScript
Stars
0
Forks
3
PR merge metrics
No merged PRs in 30d

Description

# 어떤 에러인가요?
- emotion을 이용한 style 설정시 에러가 발생함
# 에러 메시지
```
$ '{ children: Element; className: string; css: SerializedStyles; }' 형식은 'DetailedHTMLProps, HTMLDivElement>' 형식에 할당할 수 없습니다.
'DetailedHTMLProps, HTMLDivElement>' 형식에 'css' 속성이 없습니다. ts(2322)
```
# 에러 핸들링 방법
- 핸들링 방법에 대해서 간단하게 기록해보세요.
```
//오류발생코드

import { css } from '@emotion/react';

//오류 해결 코드
//해당 파일 최상단에 fragma를 추가해서 해결

/** @jsxImportSource @emotion/react */
import { css } from '@emotion/react';
```
# 에러 핸들링을 위해 참고한 레퍼런스 링크
https://velog.io/@joabyjoa/create-react-app-typescript-emotion%EC%9C%BC%EB%A1%9C-React-%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8-%EC%8B%9C%EC%9E%91%ED%95%98%EA%B8%B0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.