Visual Studio fails to acknowledge changes made to TypeScript files and incorrectly assumes that the project is up to date

I am currently utilizing TypeScript in a project based on ASP.NET Core 3 (preview 5), using the latest version of VS 2019 16.1.1 (tsc: 3.4).

Whenever I perform a "Rebuild All" or make changes to any C# files or even modify the tsconfig.json file, all my TypeScript files compile without any issues.

However, when I make modifications to any of the .ts files, save them, and then try to "Build" in VS 2019, it just displays "all up to date" and does not trigger a compilation process.

Things I've already attempted:

  • I experimented with changing the order of compileOnSave and compilerOptions, but it had no effect.
  • I also tried setting compileOnSave to either true or false, but that did not solve the issue. Although having compileOnSave set to true doesn't matter much to me personally (I would be satisfied if it compiles during build), it could offer some diagnostic insights.

Contents of tsconfig.json:

"compileOnSave": false, // whether true or false doesn't impact
"compilerOptions": {
  "module": "none",
  "noImplicitAny": true,
  "noEmitOnError": true,
  "sourceMap": true,
  "experimentalDecorators": true,
  "emitDecoratorMetadata": true,
  "target": "es2015",
  "lib": [
    "es2015",
    "es5",
    "dom"
  ],
  "outDir": "wwwroot/js/gen-ts",
  "typeRoots": [
    "./wwwroot/lib/@types"
  ]
},
"include": [
  "./Scripts"
]

Answer №1

  1. Shut down Visual Studio.
  2. Locate the file named yourprojectname.csproj.
  3. Open yourprojectname.csproj with any text editor of your choice.
  4. Modify the line
    <None Include="tsconfig.json" /> TO <Content Include="tsconfig.json" />

I hope you find this information helpful.

Answer №2

Thank you for sharing your project with us. I encountered a similar issue on my end as well.

Based on my observations, here are some suggestions that might help resolve the issue:

1. Consider moving your .ts files from the Common folder to the Scripts folder, given that your tsconfig.json file specifies:

"include": [
  "./Scripts"

2. Navigate to Tools => Options => Projects and Solutions => .NET Core => Up-To-Date Checks => Ensure that the option

Don't call msbuild if a project appears to be up-to-date
is checked.

3. Try deleting the bin and obj folders, then rebuild the solution.

(Although I'm uncertain which of these steps truly contributed to resolving the issue, through various modifications and tests, I have seen improvements)

4. Following these steps, the build output should typically show a successful build message even without any code changes.

Yet, it seems that only certain files are regenerated upon specific changes:

1. Modifying an xx.ts file will regenerate only the corresponding xx.js file (Check the modified timestamps of the .js files).

2. Changes made to an xx.cs file will trigger regeneration of the .dll and other related files, excluding the xx.js file.

Overall, it appears that the build process is nearly back to normal functionality, despite occasionally misleading build outputs. Should this persist, consider reporting the issue via the Help menu => Send Feedback => Report a Problem option.

Please feel free to correct me if I've misunderstood anything in my explanation.

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

Having Trouble Adding Details to a New Cart for a User in Angular and MongoDB - What's Going On?

After working on an E-Commerce site for a while, I hit a roadblock. Despite taking a break and coming back with determination, I can't seem to resolve the issue at hand. The application features registration, login, product search, and a popup window ...

How to access the types of parameters in a function type

I am working on a function that takes a value and default value as arguments. If the value is a boolean, I want the return type to match the type of the default value. Here is the function I have: export type DetermineStyledValue<T> = ( value: str ...

No declaration file was found for the module named 'vue2-timepicker'

Overview I integrated the vue2-timepicker plugin into my Typescript/Nuxt.js application. However, I encountered an issue with importing vue2-timepicker. import timepicker from 'vue2-timepicker' Could not find a declaration file for module &apos ...

Is it possible to assign default values to optional properties in JavaScript?

Here is an example to consider: interface Parameters { label: string; quantity?: number; } const defaultSettings = { label: 'Example', quantity: 10, }; function setup({ label, quantity }: Parameters = { ...defaultSettings }) { ...

Preventing data binding for a specific variable in Angular 2: Tips and tricks

How can I prevent data binding for a specific variable? Here's my current approach: // In my case, data is mostly an object. // I would prefer a global solution function(data) { d = data; // This variable changes based on user input oldD = da ...

The .env file setting does not take precedence over the default value in the

I am facing an issue with my JSON file that contains the default convict configuration. Here is a simplified version of the file: { "env": { "doc": "The application environment.", "format": [" ...

`Is there a way to effectively test an @Input component in Angular?`

Despite multiple successful attempts in the past, I am facing some difficulty getting this to function properly. Within my component, I have an input @Input data: Data, which is used in my template to conditionally display certain content. Oddly enough, du ...

Create type declarations using the Typescript compiler by running the command:

After generating my definition file ".d.ts" using tsc --declaration or setting declaration as true in the tsconfig.json, I noticed that the generated files are missing declare module "mymodule" {... } This appears to be causing issues with "tslint" which ...

Combining two sets of data into one powerful tool: ngx-charts for Angular 2

After successfully creating a component chart using ngx-charts in angular 2 and pulling data from data.ts, I am now looking to reuse the same component to display a second chart with a different data set (data2.ts). Is this even possible? Can someone guide ...

Converting Abstract Type Members from Scala to TypeScript: A Handy Snippet

I have a brief example of a value level and type level list in Scala sealed trait RowSet { type Append[That <: RowSet] <: RowSet def with[That <: RowSet](that: That): Append[That] } object RowSet { case object Empty extends RowSet { t ...

What is the best way to retain all checkbox selections from a form upon submission?

I have a batch of checkboxes that correspond to the profiles I intend to store in the database. HTML: <tr *ngFor="let profile of profiles | async"> <input type='checkbox' name="profiles" value='{{profile.id}}' ng-model=&apo ...

How to simulate a particular class from a node package using Jest mocks

In my project, I'm looking to specifically mock the Socket class from the net node module. The documentation for this can be found here. Within my codebase, there is a class structured similar to the following... import { Socket } from 'net&apo ...

The state data is not being properly updated and is getting duplicated

While developing a loop to parse my API data, I encountered an issue where the values obtained were not being captured properly for dynamically loading corresponding components based on their characteristics. The problem arose after implementing useState() ...

"An error occurs when attempting to access "this" in a static method as it

Just diving into the world of React and Typescript and currently exploring React hooks. Encountered a problem that's leaving me scratching my head. Here's the hook I'm using to fetch data: export const useFetch = <T>( fetchFunc: ( ...

react-data-table-component establishes the structure of the expanded element

Has anyone encountered an issue with the react-data-table-component? I need to pass a row type (typescript model) to the Detail component that is rendered when the row is expanded. Detail: export const Detail = (row: certificates) => { //it works fine ...

Acquiring an element through ViewChild() within Angular

I am in need of a table element that is located within a modal. Below is the HTML code for the modal and my attempt to access the data table, which is utilizing primeng. <ng-template #industryModal> <div class="modal-body"> <h4>{{&a ...

Issue detected in React Rollup: the specific module 'name' is not being exported from the node_modules directory

Currently in the process of creating a library or package from my component. The tech stack includes React, Typescript, and various other dependencies. Encountering an error while using Rollup to build the package: [!] Error: 'DisplayHint' is ...

Leveraging Vue.js and TypeScript: accessing the type of the child component through refs

In my parent component, I have a child component named with a reference passed to it: <child ref="childRef" /> When trying to execute a function inside the child component from the parent component, I face some challenges: mounted() { ...

Should I return X in async functions, or should I return "Promise.Resolve(X)"?

I've always found this to be a tricky concept to fully grasp. Let's delve into async functions in Typescript. Which implementation is accurate? async function asyncFunctionOne(string1: string, string2: string, string3: string) { var returnOb ...

Is there a way to optimize app speed in Angular2 by importing CommonModule and RouterModule in a centralized location?

I find myself constantly importing these two modules in almost every component: import { CommonModule } from '@angular/common'; import { RouterModule } from '@angular/router'; Is there a way to import them only once in the global app. ...