Error in Visual Studio 2019 - TypeScript version discrepancy

I am completely puzzled by the mismatch in Typescript versions when using Visual Studio 2019 with my .NET Core 2.2.x project. Every time I make changes to a .ts file, I receive the following warning (found in the error list):

Your project is built using TypeScript 3.4, but the TypeScript language service version currently in use by Visual Studio is 3.4.3. Your project may be utilizing TypeScript language features that will cause errors during compilation with this version of the TypeScript compiler. To get rid of this warning, either install TypeScript 3.4.3 SDK or update the TypeScript version in your project's properties.

Despite the fact that package.json explicitly states "typescript": "3.4.3", it insists that my project is created with TypeScript 3.4.

https://i.stack.imgur.com/7WQoj.png

The suggestion is to install TypeScript SDK 3.4.3, which I already have from this link. Additionally, I ran npm install -g typescript earlier, so the command tsc -v shows Version 3.4.3.

What piece of the puzzle am I overlooking?

Answer №1

I encountered a similar issue in the Task Runner Explorer.

It is assumed that TypeScript should be included in your PATH variables (verify by running 'tsc -v' in a standard command prompt).

For some time now, Visual Studio has offered the ability to select the version of TypeScript to use on a project-specific basis (right-click project => Properties => tab 'Typescript Build'). You have the option to choose an officially installed version or opt for 'Use latest available'.

In the Visual Studio Options, you can set the order and locations of 'External Web Tools' utilized when building web projects with third-party tools. Within this list, there may be an item labeled '$(PATH)'. I moved it to the top position, ensuring the globally installed TypeScript version is prioritized during searches.

I hope this information proves helpful in resolving your issue.

Answer №2

This solution has become more streamlined since the initial response.

Simply add the NuGet package Microsoft.TypeScript.MSBuild to your project.

This eliminates the need for a separate SDK installation, and Microsoft recommends using either NuGet or npm: https://learn.microsoft.com/en-us/visualstudio/javascript/javascript-in-vs-2019?view=vs-2019

In the project settings under the TypeScript Build tab, the TypeScript version will be displayed as n.n (NuGet) and will be locked in. This ensures consistency across team members working on the same project – pretty cool, right?

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

Modify the dropdown menu title dynamically based on the selection made in Angular

My Angular web-application has a dropdown menu that looks like this: <div class="btn-group" dropdown> <button dropdownToggle type="button" class="btn btn-primary dropdown-toggle">NAMEOFDROPDOWN <span class="caret"></span>&l ...

I require assistance in comprehending async/await in order to ensure that the code will pause and wait for my http.get function to

I've been reading various articles and forums, both here and on Google, about using awaits and asyncs in my code. However, no matter where I place them, the code after my http.get call always executes first. The alert messages from the calling program ...

The information in the map cannot be inferred by Typescript based on the generic key type

I encountered a TypeScript issue while refactoring an existing feature in my app. It seems that TypeScript is having trouble picking up the correct type when passing the generic type through nested functions. enum App { AppOne = 'app-one', A ...

Can TypeScript's Zod library be utilized to parse a class instance?

Using the Zod validation library with TypeScript has been a great experience for me so far. I am currently exploring the best pattern to extend Zod Schema with class-like functionality, starting with a Vector3 schema like this: const Vector3Schema = z.obj ...

A guide to implementing unit tests for Angular directives with the Jest testing framework

I am currently integrating jest for unit testing in my Angular project and I am relatively new to using jest for unit tests. Below is the code snippet for DragDropDirective: @HostListener('dragenter',['$event']) @HostListener(& ...

There is no correlationId found within the realm of node.js

Currently, I am in the process of implementing correlationId functionality using express-correlation-id. I am diligently following the guidelines provided on this page: https://www.npmjs.com/package/express-correlation-id. I have successfully imported the ...

how do I address the issue of Property 'navigation' not being found in type 'Readonly<{}> &'?

Here are two snippets of code that I am having trouble with: CustomHeader.tsx import { View, StyleSheet, Button } from 'react-native'; import { NavigationScreenProps } from 'react-navigation'; import Icon from 'react-native-vecto ...

"Discovering the method to showcase a list of camera roll image file names in a React Native

When attempting to display a list of images from the user's camera roll, I utilized expo-media-library to fetch assets using MediaLibrary.getAssetsAsync(). Initially, I aimed to showcase a list of filenames as the datasource for the images. Below is m ...

Incorporating lodash in a project with TypeScript and jspm

I seem to be missing something in my setup and would appreciate any assistance. I am working with TypeScript 2 + JSPM. I have tried various configurations in tsconfig using typeRoots and types (including adding the version number in the type name). Despite ...

Discovering a variable within an enzyme wrapper for the locate function

Struggling through testing with jest + enzyme. I have an array called OptionsArray that contains options mapped to buttons in a component. In my testing suite for the component, I attempted to do the following: import React from 'react'; import { ...

Having trouble setting up Nuxt with Typescript integration

I am venturing into the world of Typescript with Nuxt (version 2.6.1) for the first time. After creating a new project using create-nuxt-app, I followed the official guide for Typescript Support. npx create-nuxt-app my-first-app cd my-first-app npm instal ...

Are there any methods to incorporate Facebook and Google login into an Ionic progressive web app (PWA)?

After successfully developing an app in Ionic 3 for Android and iOS, I encountered a problem when adding the browser platform. The Facebook and Google login features were not functioning as expected. Despite the assurance from Ionic documentation that the ...

Setting up VSCode to run various tasks

My TypeScript project in Visual Studio Code has a specific task outlined as follows: { "version": "0.1.0", // The command is tsc. "command": "tsc", // Show the output window only if unrecognized errors occur. "showOutput": "silent", // Und ...

Exploring intricate JSON data in Angular 4 applications

Below is the json structure I have: [ { "section":{ "secName":"Module 1", "pages":[ { "pageName":"Page 1", "pageType":"brightcove", "pageData":[ { ...

Having trouble transferring data from indexedDB to an Angular Subject in order to utilize it within an Observable using ngx-indexed-db

When using ngx-indexed-db's getByKey method to retrieve data from indexedDB and passing it to the subject, there seems to be an issue. Although the data is successfully retrieved, an error occurs stating that the data is undefined when attempting to u ...

Angular - Clear the selection of <select><option> if I opt out of accepting the change

I have created a dropdown menu using HTML <select> and <option> tags, along with a JavaScript function that triggers a confirmation dialogue when an option is selected. The confirmation offers a simple choice between "yes" or "no." If the user ...

Is it possible for me to incorporate a portion of the interface?

Is it possible to partially implement an interface? export interface AuthorizeUser { RQBody: { login: string; password: string; }; RSBody: { authorizationResult: AuthorizationResult; }; }; class AuthorizeUserRQBody implements Authorize ...

Generating React Components Dynamically using TypeScript

Attempting to generate an element in React using Typescript based on the given tagName passed as props, along with additional relative element properties depending on that particular tagName. Take a look at the code snippet below: type ElementProps<Tag ...

substitute one item with a different item

I am facing an issue with updating the address object within an organization object. I receive values from a form that I want to use to update the address object. However, when I try to change the address object in the organization using Object.assign, i ...

Navigating TS errors when dealing with child components in Vue and Typescript

Recently, I encountered an issue where I created a custom class-based Vue component and wanted to access its methods and computed properties from a parent component. I found an example in the Vue Docs that seemed to address my problem (https://v2.vuejs.org ...