镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Add ability to generate ambient declarations for external commonjs modules #1236

Description

Badly needed for commonjs modules where you are more likely to ship JS code plus a generated .d.ts file.

From codeplex : https://typescript.codeplex.com/workitem/2080

Activity

  1. tlong-dev commented on Nov 22, 2014

    @tlong-dev

    This is related to, if not a duplicate of #575

    Also I completely agree with emphasis. This is by far the biggest road block when trying to make use of Typescript within our organization.

  2. sccolbert commented on Nov 24, 2014

    @sccolbert

    Absolutely 👍

    The dts-bundle package (an admitted kludge) is the only way I was able to find to make commonjs modules resusable across projects. It was painful enough that I just switched to internal modules and shoved all the dependency management into my build script. Would be awesome to have commonjs modules "just work".

  3. added
    SuggestionAn idea for TypeScript
    Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.
    on Nov 24, 2014
  4. KeithWoods commented on Dec 2, 2014

    @KeithWoods

    I believe this is a duplicate of, or very related to #17

    We're using dts-bundle to get around this, it'd be great to have compiler support.

  5. niemyjski commented on Apr 22, 2015

    @niemyjski

    +1. We really really really need this.

  6. OvidiuGuta commented on Jul 28, 2015

    @OvidiuGuta

    +1. It would be really useful.

  7. vvakame commented on Jul 28, 2015

    @vvakame
    Contributor

    👍
    We need tsc allow below syntax.

    $ cat index.d.ts
    // hand assemble
    declare module "foobar" {
      export * from "./lib/main";
    }
    

    but, now we got below error message.

    $ tsc --module commonjs index.d.ts
    index.d.ts(3,3): error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
    
  8. mribichich commented on Jan 12, 2016

    @mribichich

    +1

  9. basarat commented on Mar 1, 2016

    @basarat
    ContributorAuthor

    Now that the compiler supports node module resolution this can be closed as far as I am concerned 🌹

  10. RyanCavanaugh commented on Mar 1, 2016

    @RyanCavanaugh
    Member

    If Basarat Ali Syed (@basarat) says it's good it's good with me too 😃

  11. ca0v commented on Dec 20, 2016

    @ca0v

    Basarat Ali Syed (@basarat) can you show how this can be done? I want to do the very thing the error is saying cannot be done. What is the alternative?
    'Import or export declaration in an ambient module declaration cannot reference module through relative module name.'

  12. MemnochDaCoder commented on Feb 22, 2018

    @MemnochDaCoder

    +1

  13. locked and limited conversation to collaborators on Jun 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    SuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions