RobKohr
RobKohr

Reputation: 6943

Run typescript on a subdirectory

I have a solidjs project I am working on, and solidjs creates it's own typescript config file in the root directory for managing things in the src directory.

I added a server directory to the project with an app.ts in the root of it and a tsconfig.json in that directory to handle type script things in that directory differently than how solidjs is handling things.

From the root directory, if I run npx tsc server

I get the error

error TS6231: Could not resolve the path 'server' with the extensions: '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.

but if I cd into that directory and run npx tsc everything works fine.

How can I run tsc on that directory without actually cd'ing into that directory?

Upvotes: 1

Views: 2108

Answers (1)

IndevSmiles
IndevSmiles

Reputation: 908

You need to specify the path to the project that tsc should use. In this case your command should be:

npx tsc --p ./server

Upvotes: 3

Related Questions