I'm working on a project that was originally written in plain Javascript. I've added a Typescript folder at the root level which contains the same structure as the original javascript. The filestructure looks like this:
|_ build
| |_ automatically generated js files from Meta and src using build command
|
|_ meta
| |_ foo.js, bar.js
|
|_ src
| |_ baz.js
|
|_ typescript
| |_ meta
| |_ foo.ts, bar.ts
| |_ src
| |_ baz.ts
When I run tsc, I'd like all of the Typescript files within the typescript directory to compile out to the same structure they existed in in the Typescript directory to the root directory. However, most of the examples I've seen using the outDir have things building to a specific build folder.
{
"compilerOptions": {
"sourceMap": false,
"noImplicitAny": true,
"module": "es6",
"moduleResolution": "node",
"allowJs": true,
"target": "ES2020",
"lib": ["ES2018"],
"allowSyntheticDefaultImports": true
"outDir" : "" // what can be here to say "use include file structure - typescript dir?
},
"exclude": ["node_modules"],
"include": ["typescript/**/*"]
}
I cannot wrap the Javascript directories into a "dist" folder. How should I structure my tsconfig to build to the root level, matching the same directories inside the typescript directory?
typescript/src/baz.tslive once it has been compiled intobaz.js?metaandsrc, or are those strictly output directories for the compiled typescript?typescriptfolderimportoriginal files frommetaandsrcor are they completely independent? Note that they would overwrite existent js sources with equal names.metaandsrc, based on the directory structure above, because the.jsfiles inmetaandsrcmatch the names of those under thetypescriptdirectory. I'm not sure, though.