i18next-scanner-typescript

1.2.0 • Public • Published

i18next-scanner-typescript

Typescript support for i18next-scanner

Install

yarn add -D i18next-scanner-typescript

Usage

const typescriptTransform = require('i18next-scanner-typescript');

module.exports = {
  options: {
    func: {
      // don't pass ts or tsx here!
      extensions: ['.js', '.jsx'],
    },
    trans: {
      // don't pass ts or tsx here!
      extensions: ['.js', '.jsx'],
    },
  },
  // your i18next-scanner config
  // ...
  transform: typescriptTransform(
    // options
    {
      // default value for extensions
      extensions: [".ts", ".tsx"],
      // optional ts configuration
      tsOptions: {
        target: "es2017",
      },
    },

    // optional custom transform function
    function customTransform(outputText, file, enc, done) {
      // do something custom with the transpiled `outputText`
      parser.parseTransFromString(outputText);
      parser.parseFuncFromString(outputText);

      done();
    },
  ),
};

Double check that you don't have TS extensions in the non-transform configuration

Readme

Keywords

none

Package Sidebar

Install

npm i i18next-scanner-typescript

Weekly Downloads

16,684

Version

1.2.0

License

MIT

Unpacked Size

3.55 kB

Total Files

6

Last publish

Collaborators

  • nucleartux