Skip to content

Commit 7402d24

Browse files
author
Sergio Moreno
committed
Merge branch 'main' of https://github.com/lingui/js-lingui into compile-ts-files
2 parents 4840ac8 + 8c39c90 commit 7402d24

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

docs/guides/typescript.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ In your ``webpack.config.js``, use both ``babel-loader`` and ``ts-loader`` for T
5353
To supply babel options for the extraction process use :conf:`extractBabelOptions` configuration option.
5454

5555

56-
:conf:`compileNamespace` must be set to ``es`` (ES6 default export) in the Lingui config
56+
:conf:`compileNamespace` must be set to ``ts`` (ES6 default export) in the Lingui config
5757
otherwise compiled catalogs can't be imported using ES ``import``, but rather CommonJS ``require``:
5858

5959
.. code:: js
6060
6161
{
62-
"compileNamespace": "es"
62+
"compileNamespace": "ts"
6363
}
6464
6565
Type definitions

packages/cli/src/lingui-compile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function command(config: LinguiConfig, options) {
8282
if (doMerge) {
8383
mergedCatalogs = { ...mergedCatalogs, ...messages }
8484
} else {
85-
const namespace = options.namespace || config.compileNamespace
85+
const namespace = options.typescript ? "ts" : options.namespace || config.compileNamespace
8686
const compiledCatalog = createCompiledCatalog(locale, messages, {
8787
strict: false,
8888
namespace,
@@ -97,7 +97,7 @@ function command(config: LinguiConfig, options) {
9797
)
9898

9999
if (options.typescript) {
100-
const typescriptPath = compiledPath.replace(/\.jsx?$/, "") + ".d.ts"
100+
const typescriptPath = compiledPath.replace(/\.ts?$/, "") + ".d.ts"
101101
fs.writeFileSync(
102102
typescriptPath,
103103
`import { Messages } from '@lingui/core';

0 commit comments

Comments
 (0)