Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are there any plans to support TypeScript? #237

Open
KonradLinkowski opened this issue Nov 16, 2022 · 5 comments
Open

Are there any plans to support TypeScript? #237

KonradLinkowski opened this issue Nov 16, 2022 · 5 comments

Comments

@KonradLinkowski
Copy link

KonradLinkowski commented Nov 16, 2022

🚀 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

@dangyuzheng
Copy link

maybe, you can try converting to js in the transform function of the config.js file

@parachvte
Copy link

Use a custom transform, you can easily compile ts/tsx file to ES5/ES6 and extract translations.

@mxsxs2
Copy link

mxsxs2 commented Jan 12, 2023

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

@czabaj
Copy link

czabaj commented Feb 28, 2023

Don't know about plans, but this should help parsing ts files #88 (comment)

@capaj
Copy link

capaj commented Sep 13, 2024

https://github.com/lingui/js-lingui supports extraction from ts files no problem, you can try that for i18n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants