Skip to content

Allow configurable use of untyped transpileModule() #19587

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
2 of 15 tasks
pauldraper opened this issue Dec 11, 2020 · 4 comments
Closed
2 of 15 tasks

Allow configurable use of untyped transpileModule() #19587

pauldraper opened this issue Dec 11, 2020 · 4 comments

Comments

@pauldraper
Copy link

pauldraper commented Dec 11, 2020

🚀 Feature request

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Description

Angular CLI is slow (particularly to start up). A lot of this has to do with the time to typecheck TypeScript.

Describe the solution you'd like

An --transpileModules or --untyped option to skip typechecking.

Describe alternatives you've considered

Using webpack + babel-typescript instead. However, this misses out on the simplicity of using Angular CLI and is inconvenient to configure.

@alan-agius4
Copy link
Collaborator

Hi @pauldraper,

Thanks for this feature request.

This is related to an issue you commented on angular/angular#37585 where the Angular compiler doesn't provide a way to transpile a single module. Therefore, AOT compilation wouldn't be possible, which is the default mode in development mode.

In addition to that, this also doesn't align with the goal of the Angular CLI to having stricter type-checking rules by default. Without stricter type-checking rules a lot of TypeScript's benefits are lost, together with the possibility of earlier feedback on potential bugs using the type-checker.

NB: You can use 3rd party Angular builds and extend the Webpack configuration to replace the Angular compiler plugin with Babel TypeScript.

@pauldraper
Copy link
Author

Therefore, AOT compilation wouldn't be possible

Naturally. But Angular CLI works with both "aot": true and "aot": false (I've observed the latter to be far faster for dev).

In addition to that, this also doesn't align with the goal of the Angular CLI to having stricter type-checking rules by default.

Is that the goal?

Because Angular requires flipping two flags "fullTemplateTypeCheck": true and "strictTemplates": true to get even close to acceptable type-checking.

NB: You can use 3rd party Angular builds and extend the Webpack configuration to replace the Angular compiler plugin with Babel TypeScript.

Will this work with @Component styles/styleUrls?

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Dec 14, 2020

Hi,

Naturally. But Angular CLI works with both "aot": true and "aot": false (I've observed the latter to be far faster for dev).

JIT mode is of course faster, because there is less work for the TypeScript compiler to do. This is because in AOT mode there are Angular specific type-checks and transformations.

Because Angular requires flipping two flags "fullTemplateTypeCheck": true and "strictTemplates": true to get even close to acceptable type-checking.

Stricter type-checking in terms of not just Angular, but also TypeScripts such example of such options are: noImplicitReturns, forceConsistentCasingInFileNames, strict etc.. Note: strictTemplates is actually a super set of fullTemplateTypeCheck.

Will this work with @component styles/styleUrls?

For that you'll need a transformer, which requires type-checking.

@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 Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants