{"id":10982,"library":"grunt-typescript","title":"Grunt TypeScript Compiler (Legacy)","description":"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.","status":"abandoned","version":"0.8.0","language":"javascript","source_language":"en","source_url":"git@github.com:k-maru/grunt-typescript","tags":["javascript","gruntplugin","typescript"],"install":[{"cmd":"npm install grunt-typescript","lang":"bash","label":"npm"},{"cmd":"yarn add grunt-typescript","lang":"bash","label":"yarn"},{"cmd":"pnpm add grunt-typescript","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for running Grunt tasks.","package":"grunt","optional":false}],"imports":[{"note":"This is a Grunt task loader, not a direct JavaScript import. The Gruntfile.js executes in a CommonJS-like environment for Grunt 0.4.x.","wrong":"import { typescript } from 'grunt-typescript';","symbol":"grunt.loadNpmTasks","correct":"grunt.loadNpmTasks('grunt-typescript');"},{"note":"The configuration for the TypeScript task is nested under the 'typescript' key within grunt.initConfig().","symbol":"grunt.initConfig","correct":"grunt.initConfig({\n  typescript: { /* ... config ... */ }\n});"}],"quickstart":{"code":"module.exports = function(grunt) {\n  grunt.loadNpmTasks('grunt-typescript');\n\n  grunt.initConfig({\n    typescript: {\n      base: {\n        src: ['path/to/typescript/files/**/*.ts'],\n        dest: 'where/you/want/your/js/files',\n        options: {\n          module: 'amd', // or 'commonjs'\n          target: 'es5', // or 'es3'\n          basePath: 'path/to/typescript/files', // Deprecated, use rootDir\n          sourceMap: true,\n          declaration: true\n        }\n      },\n      concat: {\n        src: ['path/to/typescript/more/files/**/*.ts'],\n        dest: 'where/you/want/your/concatenated/file.js',\n        options: {\n          module: 'amd'\n        }\n      }\n    }\n  });\n\n  grunt.registerTask('default', ['typescript']);\n};","lang":"javascript","description":"Shows basic configuration for compiling individual TypeScript files and concatenating multiple files into a single output, defining module and target options."},"warnings":[{"fix":"Re-set your output directory using the `rootDir` option or, as a temporary measure, `keepDirectoryHierarchy` (which is also slated for deprecation). For modern projects, migrate to `grunt-ts` or `@nevware21/grunt-ts-plugin`.","message":"The `basePath` option has been deprecated. The method for determining output directories was changed to align with `tsc` behavior. Using `basePath` might lead to incorrect output directory structures or errors, or produce unexpected behavior.","severity":"breaking","affected_versions":">=0.8.0"},{"fix":"Plan to use `rootDir` instead for managing output directory structure when using a more actively maintained TypeScript compiler plugin.","message":"The `keepDirectoryHierarchy` option, while mentioned as an alternative to `basePath`, is also noted as not being available for long. Relying on it is not recommended for future compatibility.","severity":"deprecated","affected_versions":">=0.8.0"},{"fix":"For any project using modern TypeScript, migrate to a current TypeScript compiler plugin (like `grunt-ts` or `@nevware21/grunt-ts-plugin`) or a more contemporary build system (e.g., Webpack, Rollup, Vite).","message":"This package (v0.8.0) is severely outdated and only supports older TypeScript versions (likely TypeScript 1.x features) and old Node.js versions. It will fail to compile or misinterpret syntax from modern TypeScript (TypeScript 2.x and above), leading to syntax errors or unexpected behavior.","severity":"gotcha","affected_versions":">=0.8.0"},{"fix":"Ensure your project uses `grunt@0.4.x` or consider migrating to a more recent Grunt TypeScript plugin like `grunt-ts` (which has better support for newer Grunt versions) or `@nevware21/grunt-ts-plugin`.","message":"This plugin has a strict peer dependency on `grunt: ~0.4.5`. Installing it with newer Grunt versions (e.g., Grunt 1.x) might lead to installation warnings, compatibility issues, or the task failing to run correctly.","severity":"gotcha","affected_versions":">=0.8.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Downgrade your project's `grunt` dependency to `~0.4.5` in `package.json` and reinstall, or use `npm install grunt-typescript --legacy-peer-deps` (for npm 7+). Alternatively, migrate to `grunt-ts` or `@nevware21/grunt-ts-plugin` for compatibility with newer Grunt versions.","cause":"The installed Grunt version is incompatible with the specified peer dependency of grunt-typescript.","error":"Warning: `grunt-typescript` peer dependency `grunt@~0.4.5` not met. `npm install grunt@~0.4.5`"},{"fix":"This package does not support modern TypeScript. You must either downgrade your TypeScript code to match the features supported by older TypeScript 1.x compilers, or, more realistically, migrate to a modern Grunt TypeScript plugin (like `grunt-ts` or `@nevware21/grunt-ts-plugin`) or a different build tool.","cause":"The outdated TypeScript compiler bundled or referenced by `grunt-typescript` cannot parse modern TypeScript syntax or features.","error":"Error: Typescript compilation failed: TS1005: ';' expected. / TS2304: Cannot find name '...'"},{"fix":"Review the task configuration in `Gruntfile.js`. If `basePath` is used, consider replacing it with `rootDir` (if your TypeScript compiler supports it) and adjust `dest` accordingly. Be aware of the `keepDirectoryHierarchy` option's planned deprecation. For concatenation, ensure `dest` specifies a filename (`.js`) and not a directory.","cause":"Misconfiguration of output paths due to the deprecated `basePath` option or incorrect usage of `dest`, `rootDir`, or `keepDirectoryHierarchy`.","error":"Task 'typescript' failed. Missing output files or incorrect directory structure."},{"fix":"When aiming to concatenate all TypeScript files into a single JavaScript file, the `dest` option must specify the *name* of the output file, including the `.js` extension (e.g., `dest: 'build/app.js'`), rather than just a directory.","cause":"The `dest` option is configured to output to a directory instead of a specific `.js` file for concatenation.","error":"Empty js file when compiling ts to single js file."}],"ecosystem":"npm"}