Talbot White
Talbot White

Reputation: 117

Hide folder from set of files in tsconfig.json

I have a few different types of files:

*.ts *.client.ts *.server.ts

and my project is setup like:

Project/ src/ A/ B/

I would like to:
- hide all of src/A/**/* from my src/**/*.client.ts files
- hide all of src/B/**/* from my src/**/*.server.ts files.

By "hide" I mean "cannot be imported".

Is this possible using some configuration of tsconfig.json files?

Upvotes: 1

Views: 431

Answers (1)

basarat
basarat

Reputation: 276085

By "hide" I mean "cannot be imported".

You can always import a file that is not specified in the tsconfig.json. TypeScript will automatically add such imports into the compilation context.

Reason

Examples of various file organizations e.g. this is how node_modules/**/*.d.ts files get included in the compilation context.

Upvotes: 1

Related Questions