Skip to content

Enable ts-helpers by default in generated projects #3325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bryanforbes opened this issue Nov 30, 2016 · 7 comments
Closed

Enable ts-helpers by default in generated projects #3325

bryanforbes opened this issue Nov 30, 2016 · 7 comments
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@bryanforbes
Copy link

All projects generated by angular-cli have a dependency on ts-helpers, but ts-helpers is not imported into the projects (or test harness) and the compiler outputs helpers in every file that needs them (which is every file that uses decorators or extends). Using ts-helpers in generated projects by default will have the benefit of reducing build sizes for the average user.

Generated projects should have the following modifications:

  1. Add import 'ts-helpers'; at the top of src/main.ts and src/test.ts after import './polyfills.ts';
  2. Add "noEmitHelpers": true to the compilerOptions object in src/tsconfig.json

Versions.

angular-cli: 1.0.0-beta.21
node: 6.9.1
os: darwin x64

Repro steps.

  1. ng new test-project
  2. grep for import 'ts-helpers'; and find 0 instances
  3. Inspect src/tsconfig.js and find no "noEmitHelpers": true
@clydin
Copy link
Member

clydin commented Dec 2, 2016

I'm pretty sure that dependency is a leftover that was never removed.
And with the imminent release of TS 2.1, it will no longer be needed either way.

@nadavsinai
Copy link

although TS 2.1 has better support for external helpers some steps are still needed:

tsconfig.ts (aot too) --> add flag importHelpers:true
package.json --> add 'tslib' (official TS lib for helpers)

Typescript will insert the import statements itself
see here

this will give an important improvement in dist code size

@clydin
Copy link
Member

clydin commented Dec 20, 2016

Yes. However, this is blocked until the CLI supports 2.1.

@filipesilva
Copy link
Contributor

I think the TS 2.1 approach is the more adequate one for this problem, yeah.

@filipesilva filipesilva added command: build P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Dec 30, 2016
@sublimator
Copy link

When is angular-cli going to support TypeScript 2.1 ?

@filipesilva
Copy link
Contributor

Superseded by #6277

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

6 participants