René's URL Explorer Experiment


Title: fix(ngcc): correctly detect emitted TS helpers in ES5 by gkalpak · Pull Request #35191 · angular/angular · GitHub

Open Graph Title: fix(ngcc): correctly detect emitted TS helpers in ES5 by gkalpak · Pull Request #35191 · angular/angular

X Title: fix(ngcc): correctly detect emitted TS helpers in ES5 by gkalpak · Pull Request #35191 · angular/angular

Description: In ES5 code, TypeScript requires certain helpers (such as __spreadArrays()) to be able to support ES2015+ features. These helpers can be either imported from tslib (by setting the importHelpers TS compiler option to true) or emitted inline (by setting the importHelpers and noEmitHelpers TS compiler options to false, which is the default value for both). Ngtsc's StaticInterpreter (which is also used during ngcc processing) is able to statically evaluate some of these helpers (currently __assing(), __spread() and __spreadArrays()), as long as ReflectionHost#getDefinitionOfFunction() correctly detects the declaration of the helper. For this to happen, the left-hand size of the corresponding call expression (i.e. __spread(...) or tslib.__spread(...)) must be evaluated as a function declaration for getDefinitionOfFunction() to be called with. In the case of imported helpers, the tslib.__someHelper expression was resolved to a function declaration of the form export declare function __someHelper(...args: any[][]): any[];, which allows getDefinitionOfFunction() to correctly map it to a TS helper. In contrast, in the case of emitted helpers (and regardless of the module format: CommonJS, ESNext, UMD, etc.)), the __someHelper identifier was resolved to a variable declaration of the form var __someHelper = (this && this.__someHelper) || function () { ... }, which upon further evaluation was categorized as a DynamicValue (prohibiting further evaluation by the getDefinitionOfFunction()). As a result of the above, emitted TypeScript helpers were not evaluated in ES5 code. This commit changes the detection of TS helpers to leverage the existing KnownFn feature (previously only used for built-in functions). Esm5ReflectionHost's is changed to always return KnownDeclarations for TS helpers, both imported (getExportsOfModule()) as well as emitted (getDeclarationOfIdentifier()). The KnownDeclarations are then mapped to KnownFns in StaticInterpreter, allowing it to statically evaluate call expressions involving any kind of TS helpers. Jira issue: FW-1689 I tested it on ngcc-validation and it does fix the mobx-angular@3 failure (without breaking anything else 😛): angular/ngcc-validation#838 CI run

Open Graph Description: In ES5 code, TypeScript requires certain helpers (such as __spreadArrays()) to be able to support ES2015+ features. These helpers can be either imported from tslib (by setting the importHelpers TS ...

X Description: In ES5 code, TypeScript requires certain helpers (such as __spreadArrays()) to be able to support ES2015+ features. These helpers can be either imported from tslib (by setting the importHelpers TS ...

Opengraph URL: https://github.com/angular/angular/pull/35191

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:00f7c06a-2a67-1583-a19e-f6b1d8a71a48
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idCB54:14EB6E:78AA64:9E68B2:6B01A959
html-safe-nonce42df78361747915ff301f59f8bdc5432cb41715ee0c2e04395a6f08dbbf4b4b7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjU0OjE0RUI2RTo3OEFBNjQ6OUU2OEIyOjZCMDFBOTU5IiwidmlzaXRvcl9pZCI6IjIxMzc1NzU1MzM5MDU1NTM3NTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac3fac1551ffa6f283ab3e8113508a92d88844c1267b6d88cc3c33e2e91c3cd457
hovercard-subject-tagpull_request:372023807
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/angular/angular/pull/35191/files
twitter:imagehttps://avatars.githubusercontent.com/u/8604205?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/8604205?s=400&v=4
og:image:altIn ES5 code, TypeScript requires certain helpers (such as __spreadArrays()) to be able to support ES2015+ features. These helpers can be either imported from tslib (by setting the importHelpers TS ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/angular/angular/pull/35191/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fpull%2F35191%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fpull%2F35191%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://github.com/angular/angular/pull/35191/files
Reloadhttps://github.com/angular/angular/pull/35191/files
Reloadhttps://github.com/angular/angular/pull/35191/files
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues836 (836)https://github.com/angular/angular/issues
Pull requests143 (143)https://github.com/angular/angular/pulls
Discussionshttps://github.com/angular/angular/discussions
Actionshttps://github.com/angular/angular/actions
Projectshttps://github.com/angular/angular/projects
Security and quality40 (40)https://github.com/angular/angular/security
Insightshttps://github.com/angular/angular/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fangular%2Fangular%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fangular%2Fangular%2Fissues%2Fnew%2Fchoose
gkalpakhttps://github.com/gkalpak
angular:masterhttps://github.com/angular/angular/tree/master
gkalpak:fix-ngcc-emitted-helpershttps://github.com/gkalpak/angular/tree/fix-ngcc-emitted-helpers
Conversation 33 https://github.com/angular/angular/pull/35191
Commits 6 https://github.com/angular/angular/pull/35191/commits
Checks 0 https://github.com/angular/angular/pull/35191/checks
Files changed https://github.com/angular/angular/pull/35191/files
Please reload this pagehttps://github.com/angular/angular/pull/35191/files
fix(ngcc): correctly detect emitted TS helpers in ES5 https://github.com/angular/angular/pull/35191/files#top
Show all changes 6 commits https://github.com/angular/angular/pull/35191/files
b110634 fix(ngcc): handle imports in dts files when processing CommonJS gkalpak Feb 10, 2020 https://github.com/angular/angular/pull/35191/commits/b110634bac843c1d6dbb55276033615b3293a762
f93ec81 refactor(compiler-cli): rename the `BuiltinFn` type to the more gener… gkalpak Feb 3, 2020 https://github.com/angular/angular/pull/35191/commits/f93ec819753978a0d92d43a7e06f13224d32455b
df1dbd2 fix(ngcc): correctly detect emitted TS helpers in ES5 gkalpak Feb 6, 2020 https://github.com/angular/angular/pull/35191/commits/df1dbd2cda94930d8b8d855a67eeff68eb235fb9
e29b70c fixup! fix(ngcc): correctly detect emitted TS helpers in ES5 gkalpak Feb 13, 2020 https://github.com/angular/angular/pull/35191/commits/e29b70cfed132342447241364743c3d9c735df1c
e0f58eb fixup! fix(ngcc): correctly detect emitted TS helpers in ES5 gkalpak Feb 13, 2020 https://github.com/angular/angular/pull/35191/commits/e0f58eb38a21b00db250938d139d4963cb460db0
7e8850a fixup! fix(ngcc): correctly detect emitted TS helpers in ES5 gkalpak Feb 18, 2020 https://github.com/angular/angular/pull/35191/commits/7e8850a44932c8e467b2535b9e31cca9ba5622e7
Clear filters https://github.com/angular/angular/pull/35191/files
Please reload this pagehttps://github.com/angular/angular/pull/35191/files
Please reload this pagehttps://github.com/angular/angular/pull/35191/files
commonjs_host.ts https://github.com/angular/angular/pull/35191/files#diff-39b1d4e5eef7a09fe5e7d016596c2e5faca423bd2a3a6b394da7f755d537712e
esm5_host.ts https://github.com/angular/angular/pull/35191/files#diff-c5c2b1303426d47925e9a05fa2124db9edf2fd284f81ab1a85676f54f18107a0
umd_host.ts https://github.com/angular/angular/pull/35191/files#diff-5d0863b117d9dd32f96881acfdd6ae2a16b1090835527627e3df661d0a3df0ce
utils.ts https://github.com/angular/angular/pull/35191/files#diff-80d7bef7a408f6f49d97d8436ae6ab20186b2f133c9101a65735943b0cd61b7d
commonjs_host_spec.ts https://github.com/angular/angular/pull/35191/files#diff-0db82dee3e42c4dd42541af6804480af5c328f5b679cf2d9f33972527eca27c5
esm5_host_spec.ts https://github.com/angular/angular/pull/35191/files#diff-42557bc6689586acf48908cc8f6488ebcb7bd0239e54fe478ed2b8f008eb58b6
umd_host_spec.ts https://github.com/angular/angular/pull/35191/files#diff-284ab9d6a8ea565f9239b8ba018bd21140c2739accdf565dc7e7a8cae08cd893
ngcc_spec.ts https://github.com/angular/angular/pull/35191/files#diff-d709786f58ef391ef6039b5db9baebdc63ba5bfb81ed83cd41303ed03572cd39
utils_spec.ts https://github.com/angular/angular/pull/35191/files#diff-2a8d3f3a5281715816581a94ae9f6c7cd258be1b8a02e0ee64df87a737efb6be
index.ts https://github.com/angular/angular/pull/35191/files#diff-505b6a0e9eb58ae2414b68ccabe50e111fb01ea3d1440dc2fb76cbbc4a184387
builtin.ts https://github.com/angular/angular/pull/35191/files#diff-7a6d7eadd908c6a86ca94c99ecd83ed56dd5c6ebce80ed647756f4358b18b2a3
interpreter.ts https://github.com/angular/angular/pull/35191/files#diff-98cea8a12b382bb5d7c5d5d599a879b253adf3baa865dbc533fec578538980b9
known_declaration.ts https://github.com/angular/angular/pull/35191/files#diff-af987f284e38a45beab26ab471df9a1644a9c4741ad01a4dcf66907fedc7cc4f
result.ts https://github.com/angular/angular/pull/35191/files#diff-634c80cf63a92b18037f87ca955ce4157e71b4394376ebcbd3f5760bab983e62
ts_helpers.ts https://github.com/angular/angular/pull/35191/files#diff-052683763802ce3f36d749d7e05a23ec88fcd4bba204850d4f972e34b034fca7
evaluator_spec.ts https://github.com/angular/angular/pull/35191/files#diff-c6c2f00ba140770ed45ec68adb15c6d80246277144625ef7793843e98063a829
host.ts https://github.com/angular/angular/pull/35191/files#diff-e7f1562798d174a4ababbfbf02ea86bd4c83efa846959878d56db221cc3dd389
typescript.ts https://github.com/angular/angular/pull/35191/files#diff-f64171de3bc6bd3aca1ecb9a6f9711ee7b5e5e87d8c01bb4759aca4831baa71d
packages/compiler-cli/ngcc/src/host/commonjs_host.tshttps://github.com/angular/angular/pull/35191/files#diff-39b1d4e5eef7a09fe5e7d016596c2e5faca423bd2a3a6b394da7f755d537712e
View file https://github.com/gkalpak/angular/blob/7e8850a44932c8e467b2535b9e31cca9ba5622e7/packages/compiler-cli/ngcc/src/host/commonjs_host.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/angular/angular/pull/35191/{{ revealButtonHref }}
https://github.com/angular/angular/pull/35191/files#diff-39b1d4e5eef7a09fe5e7d016596c2e5faca423bd2a3a6b394da7f755d537712e
https://github.com/angular/angular/pull/35191/files#diff-39b1d4e5eef7a09fe5e7d016596c2e5faca423bd2a3a6b394da7f755d537712e
https://github.com/angular/angular/pull/35191/files#diff-39b1d4e5eef7a09fe5e7d016596c2e5faca423bd2a3a6b394da7f755d537712e
https://github.com/angular/angular/pull/35191/files#diff-39b1d4e5eef7a09fe5e7d016596c2e5faca423bd2a3a6b394da7f755d537712e
https://github.com/angular/angular/pull/35191/files#diff-39b1d4e5eef7a09fe5e7d016596c2e5faca423bd2a3a6b394da7f755d537712e
https://github.com/angular/angular/pull/35191/files#diff-39b1d4e5eef7a09fe5e7d016596c2e5faca423bd2a3a6b394da7f755d537712e
packages/compiler-cli/ngcc/src/host/esm5_host.tshttps://github.com/angular/angular/pull/35191/files#diff-c5c2b1303426d47925e9a05fa2124db9edf2fd284f81ab1a85676f54f18107a0
View file https://github.com/gkalpak/angular/blob/7e8850a44932c8e467b2535b9e31cca9ba5622e7/packages/compiler-cli/ngcc/src/host/esm5_host.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/angular/angular/pull/35191/{{ revealButtonHref }}
https://github.com/angular/angular/pull/35191/files#diff-c5c2b1303426d47925e9a05fa2124db9edf2fd284f81ab1a85676f54f18107a0
https://github.com/angular/angular/pull/35191/files#diff-c5c2b1303426d47925e9a05fa2124db9edf2fd284f81ab1a85676f54f18107a0
https://github.com/angular/angular/pull/35191/files#diff-c5c2b1303426d47925e9a05fa2124db9edf2fd284f81ab1a85676f54f18107a0
https://github.com/angular/angular/pull/35191/files#diff-c5c2b1303426d47925e9a05fa2124db9edf2fd284f81ab1a85676f54f18107a0
https://github.com/angular/angular/pull/35191/files#diff-c5c2b1303426d47925e9a05fa2124db9edf2fd284f81ab1a85676f54f18107a0
https://github.com/angular/angular/pull/35191/files#diff-c5c2b1303426d47925e9a05fa2124db9edf2fd284f81ab1a85676f54f18107a0
https://github.com/angular/angular/pull/35191/files#diff-c5c2b1303426d47925e9a05fa2124db9edf2fd284f81ab1a85676f54f18107a0
https://github.com/angular/angular/pull/35191/files#diff-c5c2b1303426d47925e9a05fa2124db9edf2fd284f81ab1a85676f54f18107a0
https://github.com/angular/angular/pull/35191/files#diff-c5c2b1303426d47925e9a05fa2124db9edf2fd284f81ab1a85676f54f18107a0
packages/compiler-cli/ngcc/src/host/umd_host.tshttps://github.com/angular/angular/pull/35191/files#diff-5d0863b117d9dd32f96881acfdd6ae2a16b1090835527627e3df661d0a3df0ce
View file https://github.com/gkalpak/angular/blob/7e8850a44932c8e467b2535b9e31cca9ba5622e7/packages/compiler-cli/ngcc/src/host/umd_host.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/angular/angular/pull/35191/{{ revealButtonHref }}
https://github.com/angular/angular/pull/35191/files#diff-5d0863b117d9dd32f96881acfdd6ae2a16b1090835527627e3df661d0a3df0ce
https://github.com/angular/angular/pull/35191/files#diff-5d0863b117d9dd32f96881acfdd6ae2a16b1090835527627e3df661d0a3df0ce
https://github.com/angular/angular/pull/35191/files#diff-5d0863b117d9dd32f96881acfdd6ae2a16b1090835527627e3df661d0a3df0ce
https://github.com/angular/angular/pull/35191/files#diff-5d0863b117d9dd32f96881acfdd6ae2a16b1090835527627e3df661d0a3df0ce
packages/compiler-cli/ngcc/src/utils.tshttps://github.com/angular/angular/pull/35191/files#diff-80d7bef7a408f6f49d97d8436ae6ab20186b2f133c9101a65735943b0cd61b7d
View file https://github.com/gkalpak/angular/blob/7e8850a44932c8e467b2535b9e31cca9ba5622e7/packages/compiler-cli/ngcc/src/utils.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/angular/angular/pull/35191/{{ revealButtonHref }}
https://github.com/angular/angular/pull/35191/files#diff-80d7bef7a408f6f49d97d8436ae6ab20186b2f133c9101a65735943b0cd61b7d
https://github.com/angular/angular/pull/35191/files#diff-80d7bef7a408f6f49d97d8436ae6ab20186b2f133c9101a65735943b0cd61b7d
https://github.com/angular/angular/pull/35191/files#diff-80d7bef7a408f6f49d97d8436ae6ab20186b2f133c9101a65735943b0cd61b7d
https://github.com/angular/angular/pull/35191/files#diff-80d7bef7a408f6f49d97d8436ae6ab20186b2f133c9101a65735943b0cd61b7d
Please reload this pagehttps://github.com/angular/angular/pull/35191/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.