Skip to content

Importing the generated node-typescript module #12

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

Closed
hadrien-toma opened this issue Jun 18, 2016 · 1 comment
Closed

Importing the generated node-typescript module #12

hadrien-toma opened this issue Jun 18, 2016 · 1 comment

Comments

@hadrien-toma
Copy link

Hello,

I am trying to import the module built by the "gulp build" command but it fails.
My Typescript version is 1.8.10.

This is what I have done :

  1. Create the module :
    mkdir my-new-project \
    && cd $_ \
    && yo node-typescript \
    && gulp build \
    && cd ..
  2. Create the project that will use the module :
    mkdir my-requiring-project \
    && cd $_ \
    && mkdir node_modules \
    && cp -r ../my-new-project ./node_modules \
    && echo "import MyNewProject = require('my-new-project')" >> index.ts
  3. Compile the project :
    tsc index.ts

This is the error :
index.ts(1,31): error TS2656: Exported external package typings file '~/dev/nodejs/projects/my-requiring-project/node_modules/my-new-project/lib/my-new-project.d.ts' is not a module. Please contact the package author to update the package definition.

Could you help me to find a way to import the created module into a new project? Any help would be greatly appreciated.

@ospatil
Copy link
Owner

ospatil commented Jun 21, 2016

It seems to be caused by empty declaration file emitted by the TypeScript compiler when nothing is exported from the source files. I could find a couple of TypeScript issues related to this - microsoft/TypeScript#6022 and microsoft/TypeScript#8124. You might want to check and try out some suggestions by other users on those issues.

@ospatil ospatil closed this as completed Jun 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants