ts-helpers

WebJar for ts-helpers

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

ts-helpers
Last Version

Last Version

1.1.2
Release Date

Release Date

Type

Type

jar
Description

Description

ts-helpers
WebJar for ts-helpers
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/ngParty/ts-helpers

Download ts-helpers

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/ts-helpers/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>ts-helpers</artifactId>
    <version>1.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/ts-helpers/
implementation 'org.webjars.npm:ts-helpers:1.1.2'
// https://jarcasting.com/artifacts/org.webjars.npm/ts-helpers/
implementation ("org.webjars.npm:ts-helpers:1.1.2")
'org.webjars.npm:ts-helpers:jar:1.1.2'
<dependency org="org.webjars.npm" name="ts-helpers" rev="1.1.2">
  <artifact name="ts-helpers" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='ts-helpers', version='1.1.2')
)
libraryDependencies += "org.webjars.npm" % "ts-helpers" % "1.1.2"
[org.webjars.npm/ts-helpers "1.1.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

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 ;)

org.webjars.npm

ngParty

next generation app developement meetup group

Versions

Version
1.1.2