animal_module_example

An example module written in TypeScript

Usage no npm install needed!

<script type="module">
  import animalModuleExample from 'https://cdn.skypack.dev/animal_module_example';
</script>

README

typescript_node_module_example

This is a library for test install and import from a total different project.

If you import this library to your project you can do:

  • import a particular module
  • extend classes
  • use interfaces on your project

This library is published on NPM packages.

Testing library


// packagetest.ts file
import * as animal_module from 'animal_module';

class Snake extends animal_module.Animal {

    constructor(name: string) { super(name); }

    move(distanceInMeters: number = 5) {
        console.log('Slithering...');
        super.move(distanceInMeters);
    }
}

let sam = new Snake('Sammy the Python');
sam.move();

Expected result

$ node packagetest.js
Slithering...
Sammy the Python moved 5m.
Galloping...
Tommy the Palomino moved 34m.

Publishing package

npm publish