[ESLint] React hook + Typescript ํ”„๋กœ์ ํŠธ ์‹œ ์„ค์ •ํ•œ rule ๊ณต์œ 
์›น (WEB)/๊ณต๋ถ€ 2020. 12. 14. 14:01

module.exports = { 'parser': '@typescript-eslint/parser', 'plugins': ['@typescript-eslint'], 'env': { 'commonjs': true, 'browser': true, 'es2021': true, 'node' : true }, 'extends': [ 'airbnb', 'airbnb/hooks', 'plugin:@typescript-eslint/recommended' ], 'parserOptions': { 'project': './tsconfig.json', 'ecmaFeatures': { 'jsx': true, }, 'ecmaVersion': 12, 'sourceType': 'module', }, 'rules': { 'inden..

[Typescript] ๊ธฐ์กด React + js ํ”„๋กœ์ ํŠธ ts๋กœ ๋ฐ”๊พธ๊ธฐ
์›น (WEB)/๊ณต๋ถ€ 2020. 12. 14. 13:58

Typescript ์ฐธ๊ณ  : https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html (Typescript ๊ณต์‹ ์‚ฌ์ดํŠธ) ๋ฐฐ์šฐ๋Š” ์ด์œ  JS์—์„œ๋Š” Type์ด ๊ณ„์† ์ฒดํฌ๋˜์ง€ ์•Š๋Š”๋‹ค. 1. ์ด๋Š” ์•”๋ฌต์  ํ˜•๋ณ€ํ™˜, hoisting, ๋ณต์žก์„ฑ ๋ฌธ์ œ๋ฅผ ์ผ์œผํ‚ฌ ์ˆ˜ ์žˆ๋‹ค. ์ด๋Ÿฌํ•œ ์ฝ”๋“œ ์ƒ์˜ ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ๋ฒ„๊ทธ๋ฅผ ์—†์• ๊ธฐ ์œ„ํ•ด typescript๋ฅผ ์ฃผ๋กœ ์‚ฌ์šฉํ•œ๋‹ค. hoisting : ๋Œ์–ด์˜ฌ๋ฆฐ๋‹ค๋Š” ๋œป. javascript์—์„œ ์„ ์–ธ๋ฌธ์„ ๋Œ์–ด์˜ฌ๋ ค ์ฝ”๋“œ์—์„œ ์‚ฌ์šฉํ•  ๋•Œ ์ˆœ์„œ์— ์ƒ๊ด€์—†์ด ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋„๋ก ํ•˜๋Š” ๊ธฐ์ˆ . typescript๋Š” ๋ณต์žกํ•œ ์˜ˆ์™ธ์ฒ˜๋ฆฌ ์ฝ”๋“œ ์—†์ด ์ด๋ฅผ ์ˆ˜ํ–‰ํ•œ๋‹ค. 2. ํ˜‘์—… ์‹œ์—๋‚˜ ์ถ”ํ›„์— ๋ณธ์ธ์ด ์ง  ์ฝ”๋“œ๋ฅผ ๋ณด์•˜์„ ๋•Œ ํƒ€์ž…์ด ์ •์˜๋˜์–ด ์žˆ์ง€ ์•Š๋‹ค๋ฉด ํ•˜๋‚˜..

[Typescript] TS2691: import .ts file
์›น (WEB)/์—๋Ÿฌํ•ด๊ฒฐ 2020. 12. 14. 13:58

TS2691: import .ts file ์ฐธ๊ณ  : https://github.com/microsoft/TypeScript/issues/37582 https://github.com/microsoft/TypeScript/issues/27481 https://github.com/microsoft/TypeScript/issues/39965 ์ด ์˜ค๋ฅ˜๋Š” typescript ํŒŒ์ผ์„ ์ฐพ์„ ์ˆ˜ ์—†์–ด์„œ ๋‚˜๋Š” ์˜ค๋ฅ˜์ด๋‹ค. import A from 'A.tsx'; ์œ„์™€ ๊ฐ™์ด ํŒŒ์ผ์„ ๋ถˆ๋Ÿฌ์˜ค๋ฉด, import ์ „์— ts / tsx ํŒŒ์ผ์ด js / jsx ๋กœ ๋ณ€ํ™˜๋˜๊ธฐ ๋•Œ๋ฌธ์— ํ•ด๋‹น ํŒŒ์ผ์„ ์ฐพ์„ ์ˆ˜ ์—†๋‹ค๋Š” ์—๋Ÿฌ๊ฐ€ ๋œฌ๋‹ค. ๋”ฐ๋ผ์„œ, ๋‹จ์ˆœํžˆ ํ™•์žฅ์ž๋ฅผ ๋ถ™์ด์ง€ ์•Š๊ณ  import ํ•ด์˜ค๋Š” ๊ฒƒ์ด ๊ฐ€์žฅ ๊ฐ„๋‹จํ•œ ๋ฐฉ๋ฒ•์ธ๋ฐ ๊ทธ๋ ‡๊ฒŒ ํ•˜๋ฉด esl..