Prune all comments from TypeScript config

Published on
1 mins read

Tired of running tsc -init and your IDE screaming that it’s not a valid JSON due to generated comments? There’s an one-liner script to clean them up.

sed -i -r '/^[ \t]*\//d; /^[[:space:]]*$/d; s/\/\*(.*?)\*\///g; s/[[:blank:]]+$//' tsconfig.json

Thank me later.