Skip to content

Require TypeScript modules as regular NodeJS module in .js files

Notifications You must be signed in to change notification settings

saivanji/require-ts-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

require-ts-module

A package for requiring TypeScript modules inside a JavaScript file

Usage

const path = require("path");
const { requireTs } = require("require-ts-module");

const absoluteModulePath = require.resolve("path/to/typescript/file.ts");
const tsModule = requireTs(absoluteModulePath);

// `tsModule` will contain variables exported by requiring module
console.log(tsModule);

About

Require TypeScript modules as regular NodeJS module in .js files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published