Creating an Untyped NPM Module | Task

Ole Ersoy
Feb - 18  -  1 min

Scenario

We wish to create a simple javascript function that will be used to test the integration and use of NPM modules without Typescript type definitions.

Approach

package.json

Create the project folder and initialize the project:

mkdir untyped-npm-module
cd untyped-npm-module
npm init -y

This creates package.json.

I set the license property to Public Domain.

index.js

touch index.js . Contents:
exports.hello = function ( name_) {
    return `Hello ${name}!!`;
};

Then we publish:

npm publish -access public

And now it’s on NPM. You can install it by running:

npm i untyped-npm-module