TypeScript no-var-require

Sunki-Kim·2023년 8월 9일
0

TypeScript

목록 보기
3/3

require를 적용하는 과정에서 (winston) Lint가 오류를 전해줬다.

ESLint: Require statement not part of import statement.(@typescript-eslint/no-var-requires)

  • no-var-require

require를 사용할 떄 import 없이 사용되는 것을 허용되지 않는다.
대신 ES2015 스타일의 임포트 혹은 import foo = require('foo')와 같이 사용을 권장한다.

해결법으론 import foo = require('foo') 와 같이 사용해준다.

profile
당신에게 가치있는 Developer가 되고자

2개의 댓글

comment-user-thumbnail
2023년 8월 10일

이렇게 유용한 정보를 공유해주셔서 감사합니다.

1개의 답글