New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ts-module-opt

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-module-opt

compile muti-files typescript module into same scope

latest
Source
npmnpm
Version
0.1.7
Version published
Maintainers
1
Created
Source

compile multi-files based ts module into same scope

first it generate a index ts file that contains all the reference file paths of this module

the it compile a js from the generated ts file

install

npm install -g ts-module-opt

compile a module directory

ts-module-opt -r typings/index.d.ts src

compile multiple module directories, generate a js file for each module

ts-module-opt -r typings/index.d.ts modulePath1 modulePath2

parameters

  • --reference {path}: add a reference file path to the tsc compiler
    • or -r {path}
  • --target es5: change the tsc targert to es5, default is es6
    • or -t es5
  • --declaration: generate the typescript declaration file (.d.ts)
    • or -d
  • --sourceMap: generate the source map

benifits

  • a main ts file is generate for the directory to maintain all the reference paths
  • all module files are compiled into same scope
  • exported types are compiled into same scope in the declaration
  • reference to ModuleName.TypeName is optimited to just TypeName when they are in same module

limitations

  • require tsc to be in system path
  • all typescript files in directory need to be in same module
  • if a type need to be used in a different file, that type must be exported even these files are in same module
  • resolving dependency might not be 100% correct, and it requires the ts source code to use 4 spaces padding

Keywords

typescript

FAQs

Package last updated on 20 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts