S
S
Svyatoslav Khusamov2017-03-11 08:48:32
Node.js
Svyatoslav Khusamov, 2017-03-11 08:48:32

How to make an NPM module in Typescript for Node.js?

How to make an NPM module in Typescript for Node.js?
Interested in the stages of creation.
Is there any way to get around without compiling the module to publish to NPM?
To clarify: I need to build a module that will be used in another TS module.
I did the following:
package.json

{
  "name": "express-typescript",
  "main": "index.ts",
  "typings": "index.d.ts",
  ...
}

index.ts
export * from './src/Server';
index.d.ts
export declare module 'express-typescript' {
  export * from 'index';
}

In my program I connect and get an error:
Cannot find module 'express-typescript'.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2017-03-11
@k12th

It is possible without compilation, only those who also use TS can use it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question