HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
🧐
Sonny
/
🧐
tsconfig를 extends해서 사용할 때, 현재 tsconfig가 어떤식으로 되어 있는지 확인하기
🧐

tsconfig를 extends해서 사용할 때, 현재 tsconfig가 어떤식으로 되어 있는지 확인하기

상태
해결
작성일
Aug 17, 2023
태그
WorkSpace

tsconfig를 extends할 때, compilerOptions가 어떻게 해석되는지 가시적으로 보고 싶은 경우

AS-IS

// packages/packageA/tsconfig.json { "extends": "../../tsconfig.json", "compilerOptions": { "baseUrl": "./", "outDir": "./dist", "paths": { "@/*": ["src/*"], "#/*": ["test/*"] }, "typeRoots": ["../../node_modules/@types", "node_modules/@types", "../../@types"], "jsx": "react" }, "include": ["src", "test", "vite.config.ts", "../../@types"], "exclude": ["../../node_modules", "node_modules", "dist"] }

TO-BE

// printTsConfig.js const ts = require('typescript') const configPath = ts.findConfigFile('.', ts.sys.fileExists, 'tsconfig.json') const readResult = ts.readConfigFile(configPath, ts.sys.readFile) const config = ts.parseJsonConfigFileContent(readResult.config, ts.sys, '.') console.log(JSON.stringify(config.options, null, 2))
node printTsConfig.js > tsconfig.generated.json
tsconfig.generated.json 확인하면 된다!
⇒ eslint는 자체 명령어가 있지만 ts는 없기 때문에 위처럼 활용하쟈
 
 
“tsc --showConfig” 로도 확인이 가능하지만 간단하게 설정 부분만 파일로 출력하려면 위 방법 이용해도 됨