$files = Get-ChildItem -File -Recurse -Filter *.js foreach($file in $files) { $name = $file.Name -Replace '\.js$','.ts' Rename-Item -Path $file -NewName $name }
A first stept to prepare some files:
lebab --replace ./**/*.js --transform commonjs # some notes: # import globals export const angular = (window as any).angular; const moment = (window as any).moment; # Search/Replace *.ts in vscode: ^require\('(.*)'\); import "$1"; # Search/Replace *.ts in vscode: \bwindow\. (window as any). import dateHelper from "../../../helpers/dateHelper"; => import * as dateHelper from "../../../helpers/dateHelper";
For more see: https://solidt.eu/site/lebab-modernizing-javascript/
632100cookie-checkPowershell: Recursive Rename files (Javascript to Typescript)