What settings do I need to adjust in order to set up VSCode to be compatible with TypeScript

I'm currently struggling to set up VSCode with TypeScript and facing some difficulties.

My focus is on the following:

https://code.visualstudio.com/docs/languages/typescript

It seems like after installing the compiler, VSCode should function properly. However, when looking at the following configuration files:

tsconfig.json

{
  { 
  "compilerOptions": {
    "target": "es5",                          
    "module": "commonjs",                     
    "esModuleInterop": true                  
  }
}

package.json

{
  "name": "blahh",
  "version": "1.0.0",
  "description": "tryme",
  "main": "index.js",
  "author": "ghost",
  "license": "MIT",
  "devDependencies": {
    "typescript": "^3.4.5"
  }
}

tasks.json

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "tsc-watch",
      "command": "tsc",
      "args": ["-w", "-p", "."],
      "type":"shell",
      "isBackground": true,
      "group":"build",
      "problemMatcher": "$tslint5",
      "presentation":{
        "reveal": "always",
      }
    }
  ]
}

Project

https://i.sstatic.net/AdQ6R.png

HelloWorld.ts

function sayHello(name: string): void {
    console.log(`Hello ${name}!`);
}

sayHello(1);

When I run the build task or tsc from the terminal, it correctly points out an error until I change the 1 to a string, then generates HelloWorld.js. However, the editor lacks IntelliSense, code completion, or error highlighting.

I've attempted various solutions, such as:

VSCode TypeScript Intellisense not workin

Additional observations:

  1. No TypeScript version number displayed in the editor border (as seen in example screenshots).

https://i.sstatic.net/ypPTR.png

  1. When attempting to add the build task via: https://code.visualstudio.com/docs/editor/tasks#vscode, no tsc:* templates were shown.

VSCode Info

Version: 1.33.1 (user setup)
Commit: 51b0b28134d51361cf996d2f0a1c698247aeabd8
Date: 2019-04-11T08:27:14.102Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17134

Installed Extensions

Built In

TypeScript Language Basics: Enabled
... many others 

External

(List of extensions installed...)

What am I possibly missing or overlooking in my setup to activate the interactive features of VSCode for TypeScript?

Answer №1

Ensure that the

TypeScript and JavaScript Language Features
extension is activated. You can check this by searching for @builtin typescript in the extensions view.

https://i.sstatic.net/QRt54.png

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

Challenges in Displaying Components in React with Typescript

I'm currently facing an issue where the content I am trying to render on my screen is not appearing. Although the function correctly enters the if conditional statement, as confirmed by console logging. This is the section where I have implemented th ...

Working with <html> response data in place of Json in Angular 6

My Angular 6 application needed to call a web service that returns HTML data, which I then had to display within a div. Below is an example of the HTML response data from the service: <html> <head> <title>Chart : 180: Abraham, Male, 1 ...

At first, Typescript generics make an inference but are ultimately specified

In my TypeScript code, I have defined a custom Logger class with specific options. The DefaultLevel type is created as a union of 'info' and 'error'. The LoggerOptions interface includes two generics, CustomLevels and Level, where Custo ...

Error: The function 'some' is not recognized in the rawData variable in REACT/ANTDESIGN

I've been grappling with this issue for nearly a full day now. Despite exhausting all possible solutions and conducting extensive searches, I'm still stumped. My task is to create a table using ant design where all the users are displayed upon i ...

Error: Property 'content' is not defined and cannot be read

I encountered an issue with a config file while attempting to build with AOT using the command ionic cordova build android --prod Error: ./src/config/.env.ts Module build failed: TypeError: Cannot read property 'content' of undefined at Object ...

Error encountered: The term 'interface' is a restricted keyword

I am in the process of developing a NodeJS and MongoDB library for performing CRUD operations on APIs. My goal is to establish an interface with Typescript that includes the url and database name, structured as follows: However, I am encountering this par ...

Is there a way to access the state value within the reducer function of createSlice?

Currently, I am utilizing redux-toolkit within my react project. A concern arises in a specific reducer inside the createSlice method where I aim to incorporate an existing array of entities from the state and then merge it with a new array before finalizi ...

Obtain checkbox input from HTML using Angular 2 typescript

Within my HTML code, I have defined two checkboxes in the following manner: <label><input type="checkbox" id="checkbox1" /> Folder 1: </label> <label><input type="checkbox" id="checkbox2" /> Folder 2: </label> I am fac ...

What is the best way to obtain the actual name of a component's method?

Just to clarify the next part: payU serves as the Internet payment operator I'm currently facing a significant challenge when it comes to integrating my Angular app with payU payments. Due to security reasons, I have opted not to store or pass credit ...

After a loop, a TypeScript promise will be returned

I am facing a challenge in returning after all calls to an external service are completed. My current code processes through the for loop too quickly and returns prematurely. Using 'promise.all' is not an option here since I require values obtain ...

Trouble Loading TypeScript Class in Cast Situation

I've encountered an issue with my TypeScript model while using it in a cast. The model does not load properly when the application is running, preventing me from accessing any functions within it. Model export class DataIDElement extends HTMLElement ...

Tips for correctly setting object initial values in React CreateContext

How can I correctly define the initial value of the constance trainsDetails in React Create Context? The trainsDetails is an object with various properties, fetched as a single object from an endpoint and has the values specified below in the TrainsDetails ...

What is the best approach to transpiling TypeScript aliased paths to JavaScript?

I am currently facing an issue with my TypeScript project where I need to transpile it into executable JavaScript while using path aliases for my NPM package development. One specific scenario involves importing a method from the lib directory without spe ...

Utilizing unauthorized fetch methods to modify the urql Client's fetch function contradicts TypeScript requirements

I've been struggling to make Typescript happy while redefining the fetch function on @urql/core. Although I came across two helpful solutions on Stack Overflow that seemed to address the issue, unfortunately they didn't quite work for me: fetch ...

Exploring Sequelize: Uncovering the Secret to Retrieving Multiple Associated Items of Identical Type

Within my database, I have a situation where there are two tables sharing relations of the same type. These tables are named UserCollection and ImagenProcess UserCollection has two instances that relate to ImagenProcess. Although the IDs appear unique whe ...

Develop a TypeScript Module that consolidates all exports

My Goal with TypeScript Modules I aim to streamline my TypeScript project by creating a module that contains all the necessary class exports. Currently, I find myself using relative import statements in my classes, which can make maintenance challenging i ...

Combining a plain object with a TypeScript class

I am currently working on developing a function that dynamically defines a class extending another class based on a passed object. Here is an example of what I am aiming to achieve: const ObjectMixin = function<T>(obj: T): new () => T { return ...

Having trouble resolving rxjs/operators when using ngx-datatable?

I am attempting to integrate ngx-datatable into my Angular-2 project. I have followed all the steps outlined here, but I encountered the following error: ERROR in ./~/@swimlane/ngx-datatable/release/index.js Module not found: Error: Can't re ...

Angular findIndex troubleshooting: solutions and tips

INFORMATION = { code: 'no1', name: 'Room 1', room: { id: 'num1', class: 'school 1' } }; DATABASE = [{ code: 'no1', name: 'Room 1', room: { id: 'num1', ...

Instructions on writing code to display and conceal data within an if statement

Within my angular application, I have developed a dashboard page where I have implemented a map. On the right side of the map, I have included data to display information related to the map. For example, I created a circle on the map with a 5km radius and ...