Grunt TypeScript Compiler (Legacy)

0.8.0 · abandoned · verified Sun Apr 19

grunt-typescript (version 0.8.0), last published in 2015, is an abandoned Grunt plugin designed to compile TypeScript files into JavaScript. It primarily supports older TypeScript language features (e.g., up to TypeScript 1.x) and is compatible with Grunt `~0.4.5` and Node.js `>=0.8.0`. This package is distinct from `grunt-ts` (TypeStrong/grunt-ts), which emerged as a more feature-rich and longer-maintained alternative, although `grunt-ts` itself is now in a mature maintenance phase. Due to its significant age and lack of updates, `grunt-typescript` is not suitable for modern TypeScript or Node.js projects and should be considered effectively abandoned. Users needing TypeScript compilation with Grunt should look at `grunt-ts` or `@nevware21/grunt-ts-plugin` instead.

Common errors

Warnings

Install

Imports

Quickstart

Shows basic configuration for compiling individual TypeScript files and concatenating multiple files into a single output, defining module and target options.

module.exports = function(grunt) {
  grunt.loadNpmTasks('grunt-typescript');

  grunt.initConfig({
    typescript: {
      base: {
        src: ['path/to/typescript/files/**/*.ts'],
        dest: 'where/you/want/your/js/files',
        options: {
          module: 'amd', // or 'commonjs'
          target: 'es5', // or 'es3'
          basePath: 'path/to/typescript/files', // Deprecated, use rootDir
          sourceMap: true,
          declaration: true
        }
      },
      concat: {
        src: ['path/to/typescript/more/files/**/*.ts'],
        dest: 'where/you/want/your/concatenated/file.js',
        options: {
          module: 'amd'
        }
      }
    }
  });

  grunt.registerTask('default', ['typescript']);
};

view raw JSON →