Looking at the documentation in section Working with Other JavaScript Libraries, I would have expected to see two imports:
- The first for the
.d.tsfile - The second for the actual implementation of the javascript file.
However it appears that only the .d.ts is being imported, by a weird comment reference and then URL is loaded which is declared inside the .d.ts file.
/// <reference path="node.d.ts"/>
import * as URL from "url";
let myUrl = URL.parse("http://www.typescriptlang.org");
So how does this actually work? Perhaps I might have expected to see a reference from the .d.ts file to the implementation, but I don't see that either. Is there some magic involved?
Edit: Further request for clarification.
Please confirm that the import * line referenced above does not load anything directly from the .d.ts file. It's confusing given that the first line of the file is:
declare module "url" {
which suggests that this is where the module is being loaded from.
I had thought that the reference line was used to indicate the path to indicate the .d.ts file and then the import line was loading the type information from this file.
The fact that some .d.ts files declare entities with var suggested to me that perhaps more than simply type information was contained within.