i18next-scanner
i18next-scanner copied to clipboard
Are there any plans to support TypeScript?
🚀 Feature Proposal
Support for TypeScript files
Motivation
It's impossible to parse .ts and .tsx files now which makes it hard to use with any modern project
Example
It would fix errors like:
i18next-scanner: Unable to parse Trans component from "/path/to/file.tsx"
SyntaxError: Unexpected token (6:10)
It would close #88 and #179
maybe, you can try converting to js in the transform function of the config.js file
Use a custom transform, you can easily compile ts/tsx file to ES5/ES6 and extract translations.
Maybe a bit late. Anyhow, this is what we use to scan tsx files:
rm -rf tmp/i18n && npx tsc --skipLibCheck -target es6 --module esnext --jsx preserve --outDir tmp/i18n && npx i18next-scanner --config i18next-scanner.config.js tmp/i18n/**/*.{js,jsx} && rm -rf tmp/i18n
Don't know about plans, but this should help parsing ts files https://github.com/i18next/i18next-scanner/issues/88#issuecomment-562446459