When I run tsc.exe I end up with import paths that points to the source folder.
The files in dist/typescript-angular are generate by swagger-codegen with target language typescript-angular.
tsc -d --types node --target es5 --moduleResolution node --sourceMap true --experimentalDecorators --rootDir dist/typescript-angular/fes_wecare_appointment/model/ --outDir dist/node-models/fes_wecare_appointment/ dist/typescript-angular/fes_wecare_appointment/model/*.ts
I end up with imports from the source folder
export declare namespace WecareNewAppointment {
type AppointmentTypeEnum = 'video' | 'audio' | 'chat';
const AppointmentTypeEnum: {
Video: import("../../../../../../../../../Users/x/projects/x/y/dist/typescript-angular/fes_wecare_appointment/model/slot").Slot.SlotTypeEnum;
Audio: import("../../../../../../../../../Users/x/projects/x/y/dist/typescript-angular/fes_wecare_appointment/model/slot").Slot.SlotTypeEnum;
Chat: import("../../../../../../../../../Users/x/projects/x/y/dist/typescript-angular/fes_wecare_appointment/model/slot").Slot.SlotTypeEnum;
};
}
there is no need too reference the slot type in the source folder. This is how it should look.
export declare namespace WecareNewAppointment {
type AppointmentTypeEnum = 'video' | 'audio' | 'chat';
const AppointmentTypeEnum: {
Video: import("./slot").Slot.SlotTypeEnum;
Audio: import("./slot").Slot.SlotTypeEnum;
Chat: import("./slot").Slot.SlotTypeEnum;
};
}
Can I add a tsconfig or other hints to the tsc compiler?
i would definitely add tsconfig.json folder to your project root. and configure the following:
{
"include": [
"dist/typescript-angular/fes_wecare_appointment/model/*.ts"
],
"compilerOptions": {
"types": ["node"],
"outDir": "dist/node-models/fes_wecare_appointment/",
"rootDir": "dist/typescript-angular/fes_wecare_appointment/model/",
"declaration": true,
"sourceMap": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"target": "es5"
}
}
then you jus run tsc
this makes it a bit clearer what you're trying to do. and it seems like your config is a little muddled since the included ts files and the js output are all in the same dist
driectory. and it's unclear what the rootDir
option is achieving? do you actually want baseUrl
?
Also, how are you initially writing these imports in your ts files?