Closed johan-timberit closed 1 year ago
Hi, I'm glad it's useful! I added this functionality to version 4.4.0. It can be enabled with the useImportType
option (or UseImportType
in GeneratorOptions
). It's disabled by default.
Hi! Great! What would be the best way of using GeneratorOptions? I am simply generating on build (not programatically with API) and adding attributes on the classes I want generate.
Can GenerateOptions for example be added to a config file? For example "dotnet-typegen generate -c "path_to_config_file"?
Br Johan
Yes, you can add "useImportType": true in the config file. Most parameters which are in GeneratorOptions can be used in the config JSON and vice versa.
More details on using config files are here in the docs.
Have I understodd i correctly that if I put a file in the root of the project, naming it "tgconfig.json", it will automatically used by typeGen?
I created such file and added
{ "useImportType": true }
Nothing happens when this is added.
Br Johan
There was a bug, it should be fixed in 4.4.1 and the config above should work.
Hi! First of all, really go TS-generator!
I have a question though: Would it be possible to add 'type' to auto imported classes/interfaces genreted by typeGen?
Message in VS Code: "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.ts(1371)"
Incorrect (generated by typeGen):
Correct (edited by myself)