Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
basarat opened this issue Nov 21, 2014 · 12 comments
Closed
Labels
Suggestion An idea for TypeScript

Comments

@basarat
Copy link
Contributor

basarat commented Nov 21, 2014

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

@basarat
Copy link
Contributor Author

basarat commented Nov 21, 2014

@xealot
Copy link

xealot commented Nov 22, 2014

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.

@sccolbert
Copy link

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".

@danquirk danquirk added Suggestion An idea for TypeScript Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. labels Nov 24, 2014
@KeithWoods
Copy link

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.

@niemyjski
Copy link

+1. We really really really need this.

@OvidiuGuta
Copy link

+1. It would be really useful.

@vvakame
Copy link
Contributor

vvakame commented Jul 28, 2015

👍
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.

@mribichich
Copy link

+1

@basarat
Copy link
Contributor Author

basarat commented Mar 1, 2016

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

@RyanCavanaugh RyanCavanaugh removed the Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. label Mar 1, 2016
@RyanCavanaugh
Copy link
Member

If @basarat says it's good it's good with me too 😃

@ca0v
Copy link

ca0v commented Dec 20, 2016

@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.'

@MemnochDaCoder
Copy link

+1

@microsoft microsoft locked and limited conversation to collaborators Jun 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests