Skip to content

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

@martypitt

Description

@martypitt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions