Babel
-
TSC vs BabelComputer Science/TypeScript 2023. 9. 15. 16:18
1. TypeScript 란 2. tsc 란 3. Babel 이란 4. tsc vs babel 5. tsc 사용법 6. babel 사용법 TypeScript란 TypeScript는 JavaScript의 Superset으로 기존 JavaScript문법에서 정적 타입 시스템을 추가한 것으로 코드의 안정성과 가독성을 향상시킨다. 다면 결과적으로 실행되는 코드는 JavaScript이기에 TypeScript 문법에서 JavaScript문법으로 변환되는 과정이 필요하다. 이 과정에서 크게 2가지가 사용 되는데 tsc와 @babel/preset-typescript 이다. TSC 란 tsc는 TypeScript를 JavaScript로 변환시키는 명령어로 TypeScript Compiler 라고 할 수 있다. 현재 ts..
-
[JavaScript] Jest encountered an unexpected token 해결Computer Science/JavaScript 2023. 1. 16. 21:01
Jest encountered an unexpected token SyntaxError: Cannot use import statement outside a module node js 에서 Test code를 Jest로 작성하던 중 해당 오류를 만났다. import 쪽에서 오류가 발생하였다는데 해결하는데 꽤 시간이 걸렸다. 오류의 근본적인 원인으로는 jest는 현대 문법의 js를 test 하지 못하여서 생긴다. (import 가 불가한 이유 -> Require 사용) https://dev.to/bytebodger/how-i-fixed-the-unexpected-token-error-in-jest-4o1j How I Fixed The Unexpected Token Error In Jest I recentl..