Skip to content

Instantly share code, notes, and snippets.

@michalczukm
Created April 12, 2021 17:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michalczukm/ab46d435ba7e8cf86995a3a7d627e915 to your computer and use it in GitHub Desktop.
Save michalczukm/ab46d435ba7e8cf86995a3a7d627e915 to your computer and use it in GitHub Desktop.
Moves js exercises files to TS - so now you can do the examples in TS
#!/bin/sh
npm install -D typescript @types/node @types/react @types/react-dom @types/jest
echo "{
"compilerOptions": {
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src", "./src/typings.d.ts"]
} " > tsconfig.json
for f in src/exercise/*.js; do sed -i '' '1s/^/\/\/ @ts-nocheck\'$'\n/g' "$f"; mv -- "$f" "${f%.js}.tsx"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment