Using the watch flag in TypeScript across multiple projects - A comprehensive guide

In my project, I have the following scripts section in the package.json:

"watch": "?",
"build": "npm run build:compactor && npm run build:generator && npm run build:cleaner",
"build:lambda": "npm run build:compactor:lambda && npm run build:generator:lambda && npm run build:cleaner:lambda",
"build:compactor": "tsc -p src/compactor",
"build:generator": "tsc -p src/generator",
"build:cleaner": "tsc -p src/cleaner",
"build:compactor:lambda": "npm run build:compactor && cp package.json ./dist-compactor/package.json && cd ./dist-compactor && npm install --production && zip -r ../dist-compactor.zip *",
"build:generator:lambda": "npm run build:generator && cp package.json ./dist-generator/package.json && cd ./dist-generator && npm install --production && zip -r ../dist-compactor.zip *",
"build:cleaner:lambda": "npm run build:cleaner && cp package.json ./dist-cleaner/package.json && cd ./dist-cleaner && npm install --production && zip -r ../dist-compactor.zip *",

My project is divided into 3 subprojects, each with its own configuration file that extends the main tsconfig.json.

Running tsc -w by itself will not consider the nested configurations.

I could run tsc -p src/<project> -w concurrently 3 times, but perhaps there's a built-in way in tsc to handle this more efficiently?

Answer №1

For UNIX-based systems, a potential solution could involve running the following command in order to compile multiple TypeScript projects concurrently:

tsc -w -p project1 & tsc -w -p project2

While this method should successfully compile the TypeScript code, there is a chance that you may experience unforeseen anomalies in the console window.

Answer №2

To resolve the issue, execute the command below:

tsc -w -p project1 & tsc -w -p project2

Let me know if you need further assistance.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The command npm is not recognized as internal or external - utilize nvm for installation

I have been attempting to install nodejs and npm on my Windows 10 computer. Here are the steps I followed: Downloaded the nvm setup from this link Executed the nvm install wizard using nvmsetup.exe Opened command prompt and entered 'nvm install v5.1. ...

When executing `npm run test`, the module 'sonar-request' cannot be located in 'api.js'

Whenever I conduct tests on my Sonarqube plugin, an error is returned if a class makes a call to the api. However, when there is no call to the api, everything works perfectly fine. Below is the error message: FAIL src\main\js\__tests__& ...

Error encountered while attempting to resume activity: TypeError - the function `callResume` is not defined in NativeScript Angular 2

When the resume event occurs, I must invoke the method this.callResume(). However, upon calling the method, a runtime error is thrown: TypeError: this.callResume is not a function I am uncertain about how to call a method from within the resume method ...

Encountering a problem while trying to install Ionic using 'npm install -g ionic cordova' command on a Windows

I encountered an error while attempting to install Ionic, which returned the following message: 95376 warn optional SKIPPING OPTIONAL DEPENDENCY: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1d7b6e786b7873696e5d2c332d332c28" ...

Issue with npm install in React cloned repository

I am encountering an issue with my important GitHub repository (tutorial) when I try to clone it and run npm install - npm start. The Terminal displays the following error message: react-scripts start sh: react-scripts: command not found npm ERR! file s ...

Guide on deploying a web application using Socket.io and SvelteKit on Vercel

Currently, I'm developing a multiplayer .io-style game that utilizes both Socket.io and SvelteKit. While testing the project on a local development server, everything runs smoothly. However, upon deploying to Vercel, an error message stating Failed to ...

How to utilize *ngFor alongside the async pipe for conditional rendering in Angular 8 HTML

.html <ng-container *ngFor="let contact of listContact | async; let index = index;"> <h6 class="title" *ngIf="contact && contact['type']"> {{contact['type']}} </h6> <div> {{conta ...

Using Typescript to create an interface that extends another interface and includes nested properties

Here is an example of an interface I am working with: export interface Module { name: string; data: any; structure: { icon: string; label: string; ... } } I am looking to extend this interface by adding new properties to the 'str ...

Instructions for including a class are ineffective

I am trying to dynamically add a class to a div based on two conditions. To achieve this, I have created a custom directive as shown below: import { Directive, HostBinding, Input } from '@angular/core'; @Directive({ selector: '[confirmdia ...

What is the best way to link CSS files from libraries that are downloaded using npm?

For instance, let's say I installed a package: npm install --save package and it gets saved in ./node_modules/package/ Inside that folder, there might be a directory named styles and within that directory, you could find style.css. How can I link ...

Having trouble installing the Windows build tools?

Recently, as I was delving into a book on discord.js, I came across a section that prompted me to install Windows build tools using the command "npm install --global --production --vs2015 --add-python-to-path windows-build-tools". Unfortunately, my attempt ...

When object signatures match exactly, TypeScript issues a warning

I am facing an issue with typescript while trying to use my own custom type from express' types. When I attempt to pass 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' as a parameter of type 'Context&a ...

Discovering React Styled Components Within the DOM

While working on a project using Styled Components in React, I have successfully created a component as shown below: export const Screen = styled.div({ display: "flex", }); When implementing this component in my render code, it looks like this ...

Why does TypeScript keep throwing the "No inputs were found in the config file" error at me?

Why am I receiving the No inputs were found in config file error from TypeScript? I have set up my tsconfig.json in VS Code, but the error occurs when I try to build it. The terminal displays: error TS18003: No inputs were found in config file '/Use ...

Encountering NPM Abortion Issue in Node.js

I am a beginner in node.js and have successfully installed it. However, when I try to initialize npm, I encounter an error that causes it to abort. My system has high memory capacity with 32GB RAM and 1TB HD. Although the 'npm -v' command works ...

Combining all code in Electron using Typescript

I am currently working on developing a web application using Electron written in Typescript and I am facing some challenges during the building process. Specifically, I am unsure of how to properly combine the commands tsc (used to convert my .ts file to ...

Error: npm version not recognized. The specified path could not be located

After downloading Node.js for Windows 7 from https://nodejs.org/en/download/, I encountered an issue. When I run node -v, the output shows v8.9.4. However, checking npm -v returns the following error: The system cannot find the path specified. 5.6.0 The ...

Exploring React State Management: Leveraging the Context API as a centralized store for

Currently, I am developing a React web application using TypeScript. To enhance the State Management, I decided to implement React Hooks and Context API by following a concise tutorial that I came across here. Despite diligently following the tutorial, my ...

Testing a React component that utilizes RouteComponentPropsTesting a React component with RouteComponentProps

One of my components has props that extend RouteComponentProps defined as follows: export interface RouteComponentProps<P> { match: match<P>; location: H.Location; history: H.History; staticContext?: any; } When I use this component i ...

The type argument '(id: any, title: any, body: any, image: any) => Element' does not match the parameter type

Hello there, I am a beginner in React-Native and I'm facing an issue while trying to map data into View. Despite going through the documentation and other resources, I haven't been able to figure out what mistake I might be making. Can anyone hel ...