Let’s say that I have file lib.ts which contains
/// <reference path="assets/webgl.d.ts" />
export var wrapper = 4;
Then I have file main.ts which contains
import lib = module("lib");
// when I hit space here, I see all the `webgl.d.ts` declarations
How can I stop webgl.d.ts polluting all the modules that load lib.ts? webgl.d.ts should be visible only inside of the lib.ts.
Although this isn’t what you want to happen, this is actually how the TypeScript language is documented to work. From the TypeScript Language Specification:
So the TypeScript compiler is designed to walk the dependency tree for you.