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:
- No TypeScript version number displayed in the editor border (as seen in example screenshots).
https://i.sstatic.net/ypPTR.png
- 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?