#declarationDir and emit

15 messages · Page 1 of 1 (latest)

misty dust
#

Hello,

Let's say I want to emit declaration files to two directories:

./src/types
./scripts/types

My actual config contains:

include: [ "./src/**/*.js", "./scripts/**/*.js" ]

But declarationDir accept only string, not array of strings. How can I configure so I emit declaration for src folder inside it's own folder and for script folder for it's own folder? E.g. everything in ./src/types is emmited to ./src/ and everything in ./scripts/ is emmited to ./scripts/types?

molten dew
#

sounds like you have 2 separate projects

#

so you should have 2 separate tsconfig files

#

have a look at project references

#

!hb project references

ruby egretBOT
formal bloom
#

you're including .js files not .ts files? Some weird setup

#

With .ts files, .js and .d.ts files are emitted in the same place as those .ts files I believe by default

#

So you probably don't need to set anything

misty dust
molten dew
#

"project" had more a meaning of "unit of code" rather than actual project in this case

#

if you have a look at the page I linked, you'll find an example showing a "source code" project and a "test project"

#

both of them relying on some common code, but having different config / mechanisms

fading basin
#

The main thing is that projects have to have a one-directional relationship, if src and scripts both depend on each other it won't work, but otherwise project references sounds reasonable here.