@averjs/typescript

typescript support for averjs

Usage no npm install needed!

<script type="module">
  import averjsTypescript from 'https://cdn.skypack.dev/@averjs/typescript';
</script>

README

@averjs/typescript

Official aver package for typescript support.

Usage

Install the package

$ yarn add --dev @averjs/typescript
#or
$ npm i -D @averjs/typescript

Add the plugin to the buildPlugins array inside your aver-config.ts

export default {
  buildPlugins: [
    '@averjs/typescript'
  ]
}

Options

You can pass either one of the following options to the plugin

export default {
  buildPlugins: [
    [
      '@averjs/typescript',
      {
        tsLoader: {},
        // or
        tsLoader: (default) => ({ ...default, /* add additional config */ }),

        forkTsChecker: {},
        // or
        forkTsChecker: (default) => ({ ...default, /* add additional config */ }),
      }
    ]
  ]
}

tsLoader

  • Type: object | function
  • Default:
    {
      transpileOnly: true,
      happyPackMode: true,
      appendTsSuffixTo: [/\.vue$/]
    }
    

You can either pass an object with the loader options, which can be found here, or you can also use a function which is getting passed the default config, can be modified and should return a valid config.

forkTsChecker

  • Type: object | function
  • Default:
    {
      typescript: {
        configFile: path.resolve(process.env.PROJECT_PATH, '../tsconfig.json'),
        extensions: {
          vue: true
        }
      },
      formatter: 'codeframe',
      async: false,
      eslint: {
        files: [
          './src/**/*.vue',
          './src/**/*.ts'
        ]
      }
    }
    

You can either pass an object with the plugin options, which can be found here, or you can also use a function which is getting passed the default config, can be modified and should return a valid config.