-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Fix array spread with sideeffects #41523
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typescript-bot
added
Author: Team
For Milestone Bug
PRs that fix a bug with a specific milestone
labels
Nov 13, 2020
rbuckton
commented
Nov 13, 2020
...reference/tsbuild/outfile-concat/initial-build/multiple-emitHelpers-in-different-projects.js
Outdated
Show resolved
Hide resolved
nitish-awasthi
approved these changes
Nov 24, 2020
@sheetalkamat did you have any other feedback? |
NOTE: The |
weswigham
approved these changes
Dec 18, 2020
The |
sheetalkamat
approved these changes
Jan 4, 2021
A new tslib has shipped. I will merge this once I resolve some new merge conflicts. |
Zzzen
pushed a commit
to Zzzen/TypeScript
that referenced
this pull request
Jan 16, 2021
* Fix array spread with sideeffects * Minor cleanup, ensure multiple emit helpers for outfile tests
Gusted
pushed a commit
to darkreader/darkreader
that referenced
this pull request
Mar 7, 2021
- Since Typescript 4.2 some Helpers to transpile to 4.2 are deprecated/removed. This includes __spread and __spreadArrays microsoft/TypeScript#41523. - We heavily use the spread syntax in Dark Reader and thus need those helper functions. - Due the upgrade of 4.2, tslib was outdated and didn't had the new helper function `__spreadArray`. - After good hours of skimming trough the compiler and using the wrong commands to update tslib(default to 1.x). manually updating it to 2.1 which includes this new functions microsoft/tslib#133 https://github.com/microsoft/tslib/releases/tag/2.1.0 the API can be properly compiled again. - Resolves #My personal issues with the API.
Gusted
pushed a commit
to darkreader/darkreader
that referenced
this pull request
Mar 7, 2021
- Since Typescript 4.2 some Helpers to transpile to 4.2 are deprecated/removed. This includes __spread and __spreadArrays microsoft/TypeScript#41523. - We heavily use the spread syntax in Dark Reader and thus need those helper functions. - Due the upgrade of 4.2, tslib was outdated and didn't had the new helper function `__spreadArray`. - After good hours of skimming trough the compiler and using the wrong commands to update tslib(default to 1.x). manually updating it to 2.1 which includes this new functions microsoft/tslib#133 https://github.com/microsoft/tslib/releases/tag/2.1.0 the API can be properly compiled again. - Resolves #My personal issues with the API. Note to myself: Now their are 2 versions installed `2.1.10` and `1.14.1` properly configuration setups should default to 2.1.10. But for sakes if I get into problems with this I hope I remember this note and don't waste some hours. Why `1.14.1`, I don't know. `npm --save-dev -E tslib` defaults to 1.14.1. It seems like an NPM bug `yarn add --dev -E tslib` gives the correct 2.1.10. Damn dependency hell =).
JoostK
added a commit
to JoostK/angular
that referenced
this pull request
Mar 13, 2021
In TypeScript 4.2 the `__spread` and `__spreadArrays` helpers were both replaced by the new helper function `__spreadArray` in microsoft/TypeScript#41523. These helpers may be used in downleveled JavaScript bundles that ngcc has to process, so ngcc has the ability to statically detect these helpers and provide evaluation logic for them. Because Angular is adopting support for TypeScript 4.2 it becomes possible for libraries to be compiled by TypeScript 4.2 and thus ngcc has to add support for the `__spreadArray` helper. The deprecated `__spread` and `__spreadArrays` helpers are not affected by this change. Closes angular#40394
JoostK
added a commit
to JoostK/angular
that referenced
this pull request
Mar 14, 2021
This commit complements the support for the `__spreadArray` helper that was added in microsoft/TypeScript#41523. The prior helpers `__spread` and `__spreadArrays` used the `__read` helper internally, but the helper is now emitted as an argument to `__spreadArray` so ngcc now needs to support evaluating it statically. The real implementation of `__read` reads an iterable into an array, but for ngcc's static evaluation support it is sufficient to only deal with arrays as is. Additionally, the optional `n` parameter is not supported as that is only emitted for array destructuring syntax, which ngcc does not have to support.
jessicajaniuk
pushed a commit
to angular/angular
that referenced
this pull request
Mar 16, 2021
…41201) In TypeScript 4.2 the `__spread` and `__spreadArrays` helpers were both replaced by the new helper function `__spreadArray` in microsoft/TypeScript#41523. These helpers may be used in downleveled JavaScript bundles that ngcc has to process, so ngcc has the ability to statically detect these helpers and provide evaluation logic for them. Because Angular is adopting support for TypeScript 4.2 it becomes possible for libraries to be compiled by TypeScript 4.2 and thus ngcc has to add support for the `__spreadArray` helper. The deprecated `__spread` and `__spreadArrays` helpers are not affected by this change. Closes #40394 PR Close #41201
jessicajaniuk
pushed a commit
to angular/angular
that referenced
this pull request
Mar 16, 2021
This commit complements the support for the `__spreadArray` helper that was added in microsoft/TypeScript#41523. The prior helpers `__spread` and `__spreadArrays` used the `__read` helper internally, but the helper is now emitted as an argument to `__spreadArray` so ngcc now needs to support evaluating it statically. The real implementation of `__read` reads an iterable into an array, but for ngcc's static evaluation support it is sufficient to only deal with arrays as is. Additionally, the optional `n` parameter is not supported as that is only emitted for array destructuring syntax, which ngcc does not have to support. PR Close #41201
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes array spread when there may be side effects, using a similar approach as #31469. As a result of these changes, both the
__spread
and__spreadArrays
helpers are now deprecated as they are no longer used. The helpers remain in emitHelpers.ts in case they are needed as part of--build
.Fixes #32959