Skip to content

nucleartux/i18next-scanner-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Typescript transform for i18next-scanner

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published