• Advertisement

• ### Popular Now

• 11
• 9
• 10
• 9
• 10
• Advertisement
• Advertisement
• Advertisement

# Node.js Tsconfig.json Being Ignored

This topic is 628 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Honestly I didn't know whether to put this in gaming or general. I am working on a phaser game and instead of using WAMP for my server I chose node.js. This isn't about phaser though it's about node.js tsconfig.

My problem is that tsconfig.json is supposed to make it so that I don't have to create a reference file (reference.d.ts), but in my situation tsconfig.json is not being read. So if I move reference.d.ts and compile my game.ts , what will happen is typescript will compile and the compiler will tell me: I don't know what this name is or that. Because it can't find the phaser file with the definitions.

I thought tsconfig.json was supposed to make referencing easy by telling the typescript compiler (1) This is root, and (2) These are all the files. I also thought that if I didn't write anything in the file it would automatically look for all the .ts files on compile, but that's not happening. In this case I have to create my own reference file and tsconfig.json is ignored.

Some facts I can think of:

1. I am using brackets not MS visual studio.
2. I created the tsconfig.json file manually (I didn't use console because I did not remember the console to it)
3. I have only one tsconfig.json file here.

4 main files here.

file#1. index.html


<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="utf-8" />
<title>Some Page</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<script src="reference/phaser.js"></script>
<script src="game.js"></script>
<script src="reference2/somescript.js"></script>
</head>
<body>
<div id="content"></div>
</body>
</html>


file#2. reference.d.ts

/// <reference path="reference/phaser.d.ts" />
/// <reference path="game.ts" />
/// <reference path="reference2/somescript.ts" />



file#3. game.ts

/// <reference path="reference.d.ts" />

{

Game Code

}


file#4. tsconfig.json

{
"compilerOptions":{
"module": "commonjs",
"target": "ES6",
"sourceMap": true,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},

"files": [
"reference/phaser.d.ts",
"reference2/somescript.ts",
"game.ts"
]
}

#### Share this post

##### Share on other sites
Advertisement

Edit: Solved the problem. Manually creating it was the problem. Had to use compiler to "tsc --init" for it to acknowledge the file.

#### Share this post

##### Share on other sites
FYI, TypeScript is new/rare enough (esp. in games) that you might have better luck asking on site with more dedicated TS users, e.g. StackOverflow (with the appropriate typescript flag) or /r/typescript).

#### Share this post

##### Share on other sites

• Advertisement