question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow .ts extension for compiled messages file

See original GitHub issue

Is 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:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
semoalcommented, Jan 13, 2021

Released in 3.4.0 🥳, also with the new version we accept lingui.config.ts thanks to @FredyC

1reaction
mjpieterscommented, Jan 11, 2021

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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

TSConfig Reference - Docs on every TSConfig option
json file. When TypeScript compiles files, it keeps the same directory structure in the output directory as exists in the input directory. For...
Read more >
TypeScript Compiling with Visual Studio Code
Step 1: Create a simple TS file ... Open VS Code on an empty folder and create a helloworld.ts file, place the following...
Read more >
Appending .js extension on relative import statements during ...
For new files, it is possible to simply add ".js" extension in the import statement in Typescript file while editing.
Read more >
Getting Started with Executing TypeScript files in ts-node
6. Run the following command to compile your TypeScript code ( main.ts ) without checking for errors ( -T ). Compiling your TypeScript ......
Read more >
TypeScript configuration - Angular
The node_modules/@angular/core/ folder of any Angular application contains several d.ts files that describe parts of Angular. You don't need to do anything to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found