typescript.api icon indicating copy to clipboard operation
typescript.api copied to clipboard

Consuming typescript.api.d.ts from another typescript module seems invalid

Open martypitt opened this issue 12 years ago • 0 comments

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.

martypitt avatar Jan 14 '14 03:01 martypitt