Skip to content

Instantly share code, notes, and snippets.

@michalczukm
Created April 12, 2021 17:07
Show Gist options
  • Save michalczukm/ab46d435ba7e8cf86995a3a7d627e915 to your computer and use it in GitHub Desktop.
Save michalczukm/ab46d435ba7e8cf86995a3a7d627e915 to your computer and use it in GitHub Desktop.

Revisions

  1. michalczukm created this gist Apr 12, 2021.
    27 changes: 27 additions & 0 deletions move-exercises-to-ts.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    #!/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