When declaration files are supposed to be stored in a separate output folder, deeper in the hierarchy, references in external .d.ts files break because TSC currently doesn't support this.
I propose to provide an option for having declaration files stored in a separate folder, so TSC may amend the corresponding reference paths in the generated code files.
In particular, I'm proposing to replace the boolean declaration option with a declarationPath string option.
The path to be set here is suggested to be the relative path between the generated .js file and its corresponding .d.ts file. This would match the behaviour of gulp-sourcemaps:
TSC --declarationPath "./headers/" --target "ES5" --module "commonjs" --removeComments -noEmitOnError
------------------------------
// relative to .js output folder
- `declarationPath: null` (default value) would not generate `.d.ts` files.
- `declarationPath: "."` and `declarationPath: ""` would generate declaration files in the same folder as the generated `.js` files (standard case).
- Any other value amends all references to `.d.ts` files pointing to (relative) locations within the project.
See SetTrend/TS18N demo failing project for reference ...
/cc #6465
Your thoughts?
When declaration files are supposed to be stored in a separate output folder, deeper in the hierarchy, references in external
.d.tsfiles break becauseTSCcurrently doesn't support this.I propose to provide an option for having declaration files stored in a separate folder, so
TSCmay amend the corresponding reference paths in the generated code files.In particular, I'm proposing to replace the boolean
declarationoption with adeclarationPathstring option.The path to be set here is suggested to be the relative path between the generated
.jsfile and its corresponding.d.tsfile. This would match the behaviour ofgulp-sourcemaps:- `declarationPath: null` (default value) would not generate `.d.ts` files. - `declarationPath: "."` and `declarationPath: ""` would generate declaration files in the same folder as the generated `.js` files (standard case). - Any other value amends all references to `.d.ts` files pointing to (relative) locations within the project.
See SetTrend/TS18N demo failing project for reference ...
/cc #6465
Your thoughts?