Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TypeScript 2.0's compiler options baseUrl, paths and rootDirs #339

Open
k7sleeper opened this issue Mar 4, 2016 · 11 comments
Open

Comments

@k7sleeper
Copy link

I'd appreciate grunt-ts to support compiler options baseUrl, paths and rootDirs of the next TypeScript release.

Currently, it works for me using passThrough but that's a bit cumbersome.

@nycdotnet
Copy link
Contributor

This will be added to grunt-ts vNext as soon as I get the chance to implement it. Thank you for the report.

@agubler
Copy link

agubler commented Aug 3, 2016

Do you know when this enhancement will land?

@nycdotnet
Copy link
Contributor

It's possible to pass any arguments you wish to tsc with grunt-ts. Please see the documentation for the additionalFlags feature here:

https://github.com/TypeStrong/grunt-ts#additionalflags

Native support for TypeScript flags are generally added to grunt-ts shortly after the official release due to churn/flags getting renamed or pulled, etc.

@agubler
Copy link

agubler commented Aug 3, 2016

Hi @nycdotnet thanks for the response, yes you can pass any argument to tsc with the additionalFlags feature unfortunately for paths it would need more integrated support from grunt-ts as you cannot pass the paths argument via the command line only through the tsconfig.json

tsc --paths returns error TS6064: Option 'paths' can only be specified in 'tsconfig.json' file.

@nycdotnet
Copy link
Contributor

I see. If that is the case, it may be difficult to support other than using the passthrough option. I will have to look into why the TypeScript team decided to not support that option from the command-line.

@agubler
Copy link

agubler commented Aug 4, 2016

Indeed. I suspected that it would be difficult to support, I did have a look through the code and issue and didn't find any specific reasoning behind not supporting the option on the command line. Perhaps it could be because maps are hard to represent as a command line option.

Yes currently I am using the passThrough options generating a target specific tsconfig.json using the projects tsconfig.json as a base in order to get this to work using paths.

@nycdotnet
Copy link
Contributor

I almost wonder if we need to get into the business of writing out a temporary tsconfig.json file based on the grunt setup, and then essentially always using pass-through. Do you see a downside there?

@zemian
Copy link

zemian commented Apr 17, 2019

Hi there, I face this same problem still. My project needs the --paths pass to tsc, but there is no way to set it. I tried passThrough options, but it still not working. Can someone give a working example of Grunfile.js that works with passThrough options?

Here is my Gruntfile.js:

module.exports = function(grunt) {
  grunt.initConfig({
    ts: {
      default : {
        tsconfig: './tsconfig.json',
        passThrough: true
      }
    }
  });
  grunt.loadNpmTasks("grunt-ts");
  grunt.registerTask("default", ["ts"]);
};

Much thanks!

@nycdotnet
Copy link
Contributor

nycdotnet commented Apr 18, 2019

make tsconfig an object.

tsconfig: {
  tsconfig: './tsconfig.json'
  passThrough: true
}

@zemian
Copy link

zemian commented Apr 19, 2019

Ah, that works! Thanks @nycdotnet !

@javatlacati
Copy link

You can workaround the limitation as I did: https://github.com/javatlacati/liniobuzz/blob/master/typescryptimplementation/Gruntfile.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants