Allow .ts extension for compiled messages file
See original GitHub issueIs your feature request related to a problem? Please describe. I am always frustrated when I have to allow ts to import js messages (eslint) or when I have to reconfigure the ts config to serve .mjs files.
Having imported
import { messages } from './locales/en/messages.mjs';
I need to:
- in
*.mjs
case allow typescript to serve multiple extensions - in
*.js
case disable import extensions check
Describe proposed solution I would like to configure the extension like this:
.linguirc
{
...
"compileNamespace": "es",
"compileExtension": "ts",
}
Describe alternatives you’ve considered
There is always alternative to setup eslint but it does not sound like a big deal to have it in config.
I have also tried to rename the file to *.ts
extension and it works like charm, (thank you @laszbalo). Example below.
"lingui:compile": "lingui compile && for f in $(find ./src/locales/* -type f -name '*.mjs'); do mv \"$f\" \"${f%.mjs}.ts\"; done"
Additional context I am using standard Create-React-App bundler with default settings, with airbnb and recommended eslint plugins.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Released in 3.4.0 🥳, also with the new version we accept lingui.config.ts thanks to @FredyC
Note that
lingui compile --typescript
merely adds a.d.ts
file with a type definition for the.js
file. It is also undocumented (but so is a lot of lingui 3, it appears).