What is the reason for Visual Studio 2019 automatically including "<TypeScriptCompile Remove />" in my project?

I am currently working on an asp.net core 2.2 project that is running on .net 4.7.2. This project includes the Microsoft.TypeScript.MSBuild nuget package.

Each time I introduce a new typescript (.ts or .tsx) file to my project, Visual Studio automatically inserts:

<ItemGroup><TypeScriptCompile Remove="myFile.ts" /></ItemGroup>

line into my project's .csproj file.

The tsconfig file for my project is as follows:

{
  "compilerOptions": {
    // Target latest version of ECMAScript.
    "target": "esnext",

    // Search under node_modules for non-relative imports.
    "moduleResolution": "node",

    // Process & infer types from .js files.
    "allowJs": false,
    "jsx": "react",

    // Don't emit; allow Babel to transform files.
    "noEmit": true,

    // Enable strictest settings like strictNullChecks & noImplicitAny.
    "strict": true,

    // Disallow features that require cross-file information for emit.
    "isolatedModules": true,

    // Import non-ES modules as default imports.
    "esModuleInterop": true,

    "skipLibCheck": true,

    "baseUrl": ".",
    "paths": {
        /* my paths */
    }
  },
  "include": [
        /* my typescript folders */
  ],
  "exclude": [ "node_modules" ]
}

It is worth noting that I am only utilizing the package for type-checking purposes, while the actual compilation is managed by Babel.

I am seeking assistance in comprehending the reason behind Visual studio's addition of these TypeScriptCompile Remove lines in my project. Is there a mistake on my end?

Answer №1

To prevent the nested filename.js and filename.js.map files from cluttering your project folder structure, the "remove" entry is included. This instruction specifically instructs Visual Studio to refrain from compiling this file, thereby enabling you to utilize an alternative compiler such as the TSC obtained through NPM or even the Angular compiler. Essentially, it serves as a directive for Visual Studio to step aside.

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

What causes the error "Angular 2 checkbox params.setValue is not functioning properly"?

import { Component } from '@angular/core'; import { GridOptions, RowNode } from 'ag-grid/main'; import { ICellRendererAngularComp } from 'ag-grid-angular'; @Component({ selector: 'qrp-drop-down-selector', ...

typescript set parameter conditionally within a function

For my upcoming app, I am working on an API that will utilize Firebase FCM Admin to send messages. Below is the code snippet: import type { NextApiRequest, NextApiResponse } from "next"; import { getMessaging } from "firebase-admin/messaging ...

Tips for dynamically modifying style mode in Vue.js

I am looking to implement a feature where the style can be changed upon clicking a button. In my scenario, I am using Sass/SCSS for styling. For example, I have three different styles: default.scss, dark.scss, and system.scss. The code for dark.scss look ...

Angular 6: Dealing with Type Errors in the HttpClient Request

I am encountering issues with my services. I am attempting to retrieve a list of media files (generated by NodeJS, which generates a JSON file containing all media items). Although I can successfully fetch the data, I am facing an error stating "Property & ...

Jest is simulating a third-party library, yet it is persistently attempting to reach

Here's a function I have: export type SendMessageParameters = { chatInstance?: ChatSession, // ... other parameters ... }; const sendMessageFunction = async ({ chatInstance, // ... other parameters ... }: SendMessageParameters): Promise<vo ...

Is it possible to dynamically retrieve an element's style from @ViewChild in an Angular 2 component without needing an active approach?

For instance, there's an element in the template that uses a local variable #targetElement to retrieve its current width whenever needed. However, I prefer not to calculate the style programmatically. I attempted using a setter with the @ViewChild ann ...

Warning: Potential spacing issues when dynamically adjusting Material UI Grid using Typescript

When working with Typescript, I encountered an error related to spacing values: TS2322: Type 'number' is not assignable to type 'boolean | 7 | 2 | 10 | 1 | 3 | 4 | 5 | 6 | 8 | "auto" | 9 | 11 | 12'. No lint errors found Version: typesc ...

When executing the release command in Ionic 3, the Angular AoT build encountered a failure

Struggling to get my Sony Z2 smartphone app running. Command used: ionic build android --prod --release Error displayed in console: typescript error Type CirckelmovementPage in C:/Users/fearcoder/Documents/natuurkundeformules/src/pages/cir ...

Express middleware generator function causing a type error

I recently implemented a function that takes a middleware function, wraps it in a try-catch block, and then returns the modified middleware function. tryCatch.ts import { Request, Response, NextFunction } from "express"; export default function ...

How come a Google Maps API component functions properly even without using *NgIf, but fails to work when excluded in Angular 9?

I recently followed the guide provided in this discussion with success. The method outlined worked perfectly for loading search boxes using this component: map.component.html <input id= 'box2' *ngIf="boxReady" class="controls" type="text" p ...

Comparing JSON import methods: HTTP vs require

I discovered two methods for importing local json files into my code. Using angulars http get. This method is well-known for loading json input. It provides the flexibility to easily switch between remote and local json files. Typescript require Anot ...

Using the useState hook in a loop can sometimes result in a unique key error

Trying to add multiple items for rendering in my browser, but encountering an issue after clicking addItem. The item does render, however, I am getting the following error message: 'Warning: Each child in a list should have a unique ""key"" ...

How can you export the type of a private class in TypeScript without exporting the class itself?

I am facing a dilemma in my module where the public method of a public class is responsible for creating and returning a new instance of a private class. The stipulation is that only MyClass should have the capability to instantiate MyClassPrivateHelper. ...

Can we determine the data type of an object based on a property within an interface?

Here is my current interface: MyInterface { prop1?: string, prop2?: string, } Now, I am looking to introduce an alternative property that mirrors the content of the existing properties but also infers if any properties are defined. For instance: ...

Mastering the art of implementing md-table with services in Angular 4

I am a newcomer to the world of angular and I am attempting to utilize the new md-table component in Angular Material 2 with Angular 4. I have created a service that fetches simple arrays of content from an API. However, I am struggling to use this servic ...

Utilize devextreme for uploading files

Currently, I am trying to implement an upload document feature using Dev-Extreme, but I keep encountering an error https://i.sstatic.net/dLxWx.png onFileUpload(event){ this.file = event.target.files[0] } <dxi-column [showInColumnChooser]="fa ...

How come TypeScript does not detect when a constant is used prior to being assigned?

There's an interesting scenario I came across where TypeScript (3.5.1) seems to approve of the code, but it throws an error as soon as it is executed. It appears that the root cause lies in the fact that value is being declared without being initiali ...

Ready to Opt-Out in RxJS 6?

My test is functioning properly at the moment, but changing the active value causes it to break. Therefore, I am looking to unsubscribe a (which is the current active Observable) before proceeding with any other tests: let a:Observable<Todo> = store ...

The React Native WebView is having trouble opening links on Android devices

There seems to be an issue with the React Native WebView component on Android where links are not opening, while on iOS it works perfectly without any hitches. When trying to open links on Android, nothing happens upon clicking and no errors are shown. H ...

Is it possible to deactivate the error message related to "Unable to ascertain the module for component..."?

I recently incorporated a new component into my TypeScript2+Angular2+Ionic2 project. Right now, I have chosen not to reference it anywhere in the project until it is fully developed. However, there seems to be an error thrown by Angular/ngc stating "Cannot ...