typescript.api
typescript.api copied to clipboard
Consuming typescript.api.d.ts from another typescript module seems invalid
Forgive me if I'm on the wrong path here, but it seems like I cannot consume the typescript.api.d.ts file as-is.
I've created a small gist to demonstrate the issue.
It seems that because the module name has a period in it (typescript.api), that it should be enclosed in quotes. ie:
declare module typescript.api {}
...
/// <reference path="typescript.api.d.ts" />
import tsapi = require("typescript.api");
results in:
error TS2071: Unable to resolve external module '"typescript.api"'.
error TS2072: Module cannot be aliased to a non-module type.
Whereas:
declare module "typescript.api" {}
...
/// <reference path="typescript.api.d.ts" />
import tsapi = require("typescript.api");
..is valid.
However, in the case of the latter scneario, it requires removing the fully-qualified references to the types (eg.,typescript.api.Variable becomes Variable).
I'm not sure if that has broader consequences.