In Visual Studio, as well as with the tsc
on Ubuntu, I routinely encounter variables in TypeScript with the message Cannot find name 'variableName', where variableName is the variable which acts like a namespace. Hence, it can be crossfilter, or d3 for example.
What does this fundamentally mean?
I suppose this means that the typing definition isn't included in the tsconfig.json file?
When I try including the relevant typings directory file
typings
├── globals
│ └── crossfilter
│ ├── index.d.ts
│ └── typings.json
├── index.d.ts
└── modules
└── d3
├── index.d.ts
└── typings.json
by
{
"compilerOptions": {
"target": "es5",
"sourceMap": false,
"outDir": "./built",
"rootDir": "src"
},
"include": [
"**/*",
"../../../typings"
],
"exclude": [
"node_modules"
],
"compileOnSave": true
}
I still get the same Cannot find name variableName error.
Edit.
I don't understand the concept of the @types feature.
Another related concept I don't understand, what is the goal of the following command,
npm install --save @types/lodash
in relation to just including the .d.ts file in a typings/ directory like the above?