Skip to content

Importing the generated node-typescript module #12

Closed
@hadrien-toma

Description

@hadrien-toma

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.

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