dts-bundle-generator icon indicating copy to clipboard operation
dts-bundle-generator copied to clipboard

Add option to override compiler options

Open timocov opened this issue 5 years ago • 7 comments
trafficstars

From https://github.com/timocov/dts-bundle-generator/issues/135#issuecomment-692472763

timocov avatar Sep 27 '20 10:09 timocov

It seems that TypeScript doesn't provide types for the compiler options which are inside json file (ts.CompilerOptions are options after processing and converting them), so it seems that the only option we have is set it to any in types 😞

timocov avatar Apr 10 '21 20:04 timocov

It seems that TypeScript doesn't provide types for the compiler options which are inside json file (ts.CompilerOptions are options after processing and converting them), so it seems that the only option we have is set it to any in types 😞

https://github.com/bluelovers/ws-ts-type/blob/master/packages/package-dts/tsconfig-json.d.ts

bluelovers avatar Jul 02 '21 11:07 bluelovers

@bluelovers are these types auto-generated/related to the compiler's code and just manually-written and have to be updated on every TypeScript release?

timocov avatar Aug 12 '21 13:08 timocov

@timocov I fork your repo and added compilerOptions,please check https://github.com/timocov/dts-bundle-generator/pull/189

keyiis avatar Mar 13 '22 05:03 keyiis

@keyiis it is not a problem to provide a way to override compiler options and just add an option for that. The problem we're facing right now is that it seems that it is impossible to provide proper types for that. If you use any it increases a chance to make a mistake or work with the tool incorrectly. This is the same if you don't use types at all (good example for this is this issue where the compiler would tell you that the options are incorrect). Right now it is much easier to create another tsconfig in your project that will extend your current one and override all the options there.

So to conclude the future of this ticket: until we don't have a proper way to describe types of the compiler options in the API it is the best way to create a tsconfig in your project (e.g. tsconfig.dts.json or so) that will extend your current config (see extends) and override options there.

timocov avatar Mar 27 '22 11:03 timocov

@timocov I see what you mean, but my compilerOptions is dynamic and can't use fixed file description.

keyiis avatar Apr 01 '22 03:04 keyiis

@keyiis as workaround I can suggest to write temporary file in your scripts and provide it as a tsconfig and then remove it later. We're here for types and it would be bad to provide any anywhere in the API or incorrect types IMO.

timocov avatar Apr 02 '22 18:04 timocov