1.1.2 • Published 9 years ago

ts-helpers v1.1.2

Weekly downloads
46,897
License
MIT
Repository
github
Last release
9 years ago

TS-helpers

Dependencies Status devDependency Status npm GitHub license

Typescript helpers (TS <= 2.0) for compiling typescript while specifying --noEmitHelpers within your tsconfig.json.

Cross platform ( Node/Browser/WebWorker )

NOTE: Starting Typescript 2.1 this package won't be needed anymore

Instead you can provide --importHelpers together with --noEmitHelpers which will import emit helpers from Typescript "tslib" More info: https://github.com/Microsoft/TypeScript/pull/9097

Why?

If you are using one of following ES2015/ES.next features with Typescript:

  • inheritance via class Foo extends Moo{}
  • async/await
  • decorators via experimentalDecorators
  • metadata reflection via emitDecoratorMetadata

Typescript will generate helper code in every one file. This can be a problem when dealing with code coverage or payload size of you library/app

To mitigate this problem Typescript starting from version 1.8 allow us to specify noEmitHelpers: truewhich wont generate these helpers.

And that's where this little utility comes into play, it defines those helpers just once for whole app.

Installation

npm install --save-dev ts-helpers

then load it from your app root file:

// main.ts
import 'ts-helpers';

and set tsconfig noEmitHelpers like following example:

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "noImplicitAny": false,
    "sourceMap": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "moduleResolution": "node",
    "pretty": true,
    "noEmitHelpers": true
  },
  "exclude": [
    "node_modules"     
  ]
}

That's it! enjoy ;)

aitarget-componentsapp14-vivesintabaco-serverperfecto-ai-reportsel-appstateel-authtrade-platform-web-appeumkstupid-project@teammaestro/loop-modules@infinitebrahmanuniverse/nolb-ts-h@everything-registry/sub-chunk-2977@flowup/ng2-tableattachment-librarytangentialtenaurtest-angular2-librarytest-exporttest-mastertest-module-apiwidget-pop-upwidget-pop-up-templatewdxweditorsupportive-supervision-tool-adminstorybuilderenginetest_dominikstrasser_coretest_dominikstrasser_sbstestdeploy591teste-component-do-luanteste-componentestestlibtestnpm1supply-pluginsupplyclone-pluginsupplypackageuw-frame-2ver-samplevidal-comments-ngxvidal-ng2-discoveryvidal-ng2-sesamevidal-ng2-toolbar@beligh/angular-markdown@rss/cs-ui-componentsitcloud-pluginjournal-demojtpdev-pdfmakerkalachappjidaiionic-calendarintegracao-componentkii-reporting-2kenya-project-pkgkee-cli-hw-cmpntkee-hw-app-modulejuno-corekit.aiij-autocompleteibis-tileshosted-sizing-estimatorhrmisgrf-uihayk-test-moduleintern-visualinterview-appinnova-angular-componentslistofreportsls2-multi-selectmangol-ng6md-input-inlinelabs-cardsky-serviceky-kliblearn-ag2-fundmentalmengjia-p1mbd-stacksmb-basemc-angular2-projectmcr-componentsmetalistiks-test-app@vidal-community/ng2-discovery@vidal-community/ng2-sesame@telerik/kendo-angular-tasksangrepeatangular-ai-chat-botandes-plexandes-sharedangular-simple-translateangular-test2angular-fblib-testangular-material-datepickerangular-material-datepicker-customizedangular-confirmangular-copyangular-components-filter-servicesaexoa-test-componentsaitarget-components-publishedaitarget-components-social-iproappaitarget-components-stableaclone-plugin
1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

10 years ago

1.0.0

10 years ago