René's URL Explorer Experiment


Title: EventEmitter.emit() should only accept T, not T | undefined. · Issue #35119 · angular/angular · GitHub

Open Graph Title: EventEmitter.emit() should only accept T, not T | undefined. · Issue #35119 · angular/angular

X Title: EventEmitter.emit() should only accept T, not T | undefined. · Issue #35119 · angular/angular

Description: 🐞 bug report Affected Package @angular/core Is this a regression? No Description The signature of EventEmiter.emit was modelled according to the signature of rxjs' Subject.next (see #10058 ). But the signature of Subject.next has a desig...

Open Graph Description: 🐞 bug report Affected Package @angular/core Is this a regression? No Description The signature of EventEmiter.emit was modelled according to the signature of rxjs' Subject.next (see #10058 ). But t...

X Description: 🐞 bug report Affected Package @angular/core Is this a regression? No Description The signature of EventEmiter.emit was modelled according to the signature of rxjs' Subject.next (see #10058 ). B...

Opengraph URL: https://github.com/angular/angular/issues/35119

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"EventEmitter.emit() should only accept T, not T | undefined.","articleBody":"# 🐞 bug report\r\n\r\n### Affected Package\r\n\r\n@angular/core\r\n\r\n\r\n### Is this a regression?\r\n\r\nNo\r\n\r\n\r\n### Description\r\n\r\nThe signature of `EventEmiter.emit` was modelled according to the signature of rxjs' `Subject.next` (see #10058 ). But the signature of `Subject.next` has a [design flaw](https://github.com/ReactiveX/rxjs/issues/2852) which has been copied to `EventEmitter.emit`.\r\n\r\nThis issue is essentially the same as https://github.com/ReactiveX/rxjs/issues/2852 , but applied to angular's EventEmitter. See repro below for details.\r\n\r\n\r\n## 🔬 Minimal Reproduction\r\n\r\n```ts\r\nconst em = new EventEmitter\u003cstring>();\r\nem.asObservable().subscribe(s => {\r\n    s.substring(0, 1); // boom\r\n});\r\nem.emit();\r\n```\r\n\r\n### Expected behavior\r\n\r\nA compile error at line 5\r\n\r\n### Actual behavior\r\n\r\nA runtime error at line 3\r\n\r\n### Details\r\n\r\nThe signature of `emit` allows emitting `undefined` on an event emitter which declares a non-nullable type.\r\nThis defeats the whole purpose of typescript's --strictNullCheck flag.\r\n\r\n\r\n## 🔥 Exception or Error\r\n\r\nNo error, that's the problem.\r\n\r\n\r\n## 🌍  Your Environment\r\n\r\nAll versions since #10058\r\n\r\n## 🔧 Suggested fix\r\n\r\nThe suggested fix is simple enough, but it is a breaking change:\r\n- Make the parameter of `emit` non-optional. One can still write `em.emit()` provided the EventEmitter is of type `EventEmitter\u003cvoid>`.\r\n- Make the default type of T `void` instead of `any` (see [this](https://github.com/ReactiveX/rxjs/issues/5066#issuecomment-581462164)) for details.\r\n\r\n```diff\r\ndiff --git a/packages/core/src/event_emitter.ts b/packages/core/src/event_emitter.ts\r\nindex 07143d9774..eaf84b7ad0 100644\r\n--- a/packages/core/src/event_emitter.ts\r\n+++ b/packages/core/src/event_emitter.ts\r\n@@ -61,7 +61,7 @@ import {Subject, Subscription} from 'rxjs';\r\n  * @see [Observables in Angular](guide/observables-in-angular)\r\n  * @publicApi\r\n  */\r\n-export class EventEmitter\u003cT extends any> extends Subject\u003cT> {\r\n+export class EventEmitter\u003cT extends any = void> extends Subject\u003cT> {\r\n   /**\r\n    * @internal\r\n    */\r\n@@ -83,7 +83,7 @@ export class EventEmitter\u003cT extends any> extends Subject\u003cT> {\r\n    * Emits an event containing a given value.\r\n    * @param value The value to emit.\r\n    */\r\n-  emit(value?: T) { super.next(value); }\r\n+  emit(value: T) { super.next(value); }\r\n \r\n   /**\r\n    * Registers handlers for events emitted by this instance.\r\n```","author":{"url":"https://github.com/hmil","@type":"Person","name":"hmil"},"datePublished":"2020-02-03T15:37:31Z","url":"https://github.com/angular/angular/issues/35119"}

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/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:7e688911-4f64-5e82-e5e6-16d2ca2f3f0c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE4D8:A71F9:122DF2C:16DF256:6B015747
html-safe-nonce2637d5250e009afbe3d3fb6a6bfd136f5d7edc2f97cd3184352128c017241c17
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNEQ4OkE3MUY5OjEyMkRGMkM6MTZERjI1Njo2QjAxNTc0NyIsInZpc2l0b3JfaWQiOiI0Njg0NzQ5ODk1MDMzMjQ3NTU5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmace17383243049d5815ef0a9b604a88bc0d140a75be4733147130d62a807243b88
hovercard-subject-tagissue:559161710
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/35119/issue_layout
twitter:imagehttps://opengraph.githubassets.com/bd5a6e6ca288372cf05da9505f178df060153a4650398c2782e210fc0572f3e3/angular/angular/issues/35119
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/bd5a6e6ca288372cf05da9505f178df060153a4650398c2782e210fc0572f3e3/angular/angular/issues/35119
og:image:alt🐞 bug report Affected Package @angular/core Is this a regression? No Description The signature of EventEmiter.emit was modelled according to the signature of rxjs' Subject.next (see #10058 ). But t...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamehmil
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
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
disable-turbofalse
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
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/35119#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F35119
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%2Fissues%2F35119
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://github.com/angular/angular/issues/35119
Reloadhttps://github.com/angular/angular/issues/35119
Reloadhttps://github.com/angular/angular/issues/35119
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues836 (836)https://github.com/angular/angular/issues
Pull requests141 (141)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
https://github.com/angular/angular
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/35119
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/35119
EventEmitter.emit() should only accept T, not T | undefined.https://github.com/angular/angular/issues/35119#top
P4A relatively minor issue that is not relevant to core functionshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P4%22
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
breaking changeshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22breaking%20changes%22
core: inputs / outputshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20inputs%20%2F%20outputs%22
cross-cutting: typeshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22cross-cutting%3A%20types%22
freq1: lowhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22freq1%3A%20low%22
state: confirmedhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20confirmed%22
state: has PRhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20has%20PR%22
type: bug/fixhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%2Ffix%22
Backloghttps://github.com/angular/angular/milestone/82
https://github.com/hmil
hmilhttps://github.com/hmil
on Feb 3, 2020https://github.com/angular/angular/issues/35119#issue-559161710
#10058https://github.com/angular/angular/pull/10058
design flawhttps://github.com/ReactiveX/rxjs/issues/2852
ReactiveX/rxjs#2852https://github.com/ReactiveX/rxjs/issues/2852
#10058https://github.com/angular/angular/pull/10058
thishttps://github.com/ReactiveX/rxjs/issues/5066#issuecomment-581462164
Nexthttps://github.com/angular/angular/issues/35119?timeline_page=1
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
on Feb 3, 2020https://github.com/angular/angular/issues/35119#event-3002704818
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
on Feb 3, 2020https://github.com/angular/angular/issues/35119#event-3002704911
mheveryhttps://github.com/mhevery
action: mergeThe PR is ready for merge by the caretakerhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22action%3A%20merge%22
target: patchThis PR is targeted for the next patch releasehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22target%3A%20patch%22
action: mergeThe PR is ready for merge by the caretakerhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22action%3A%20merge%22
target: patchThis PR is targeted for the next patch releasehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22target%3A%20patch%22
on Feb 26, 2020https://github.com/angular/angular/issues/35119#event-3072202520
mheveryhttps://github.com/mhevery
breaking changeshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22breaking%20changes%22
freq1: lowhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22freq1%3A%20low%22
severity2: inconvenienthttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22severity2%3A%20inconvenient%22
type: bug/fixhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%2Ffix%22
on Mar 3, 2020https://github.com/angular/angular/issues/35119#event-3094284446
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
Backloghttps://github.com/angular/angular/milestone/82
on Mar 3, 2020https://github.com/angular/angular/issues/35119#event-3094284970
hmilhttps://github.com/hmil
on Mar 4, 2020https://github.com/angular/angular/issues/35119#event-3098770753
feat(core): stricter event emitter typehttps://github.com/hmil/angular/commit/51a09661b4e16c0073935448e7e1f0f85d4259cb
https://docs.github.com/articles/closing-issues-via-commit-messages
51a0966https://github.com/hmil/angular/commit/51a09661b4e16c0073935448e7e1f0f85d4259cb
jelbournhttps://github.com/jelbourn
severity2: inconvenienthttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22severity2%3A%20inconvenient%22
on Oct 1, 2020https://github.com/angular/angular/issues/35119#event-3830822622
JoostKhttps://github.com/JoostK
state: has PRhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20has%20PR%22
on Oct 25, 2020https://github.com/angular/angular/issues/35119#event-3918209460
AndrewKushnirhttps://github.com/AndrewKushnir
triage #1https://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22triage%20%231%22
on Mar 15, 2022https://github.com/angular/angular/issues/35119#event-6239500924
https://github.com/JeanMeche
JeanMechehttps://github.com/JeanMeche
on Mar 23, 2024https://github.com/angular/angular/issues/35119#issuecomment-2016525767
JeanMechehttps://github.com/JeanMeche
completedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Mar 23, 2024https://github.com/angular/angular/issues/35119#event-12224645352
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Apr 23, 2024https://github.com/angular/angular/issues/35119#issuecomment-2071153179
automatic conversation locking policyhttps://github.com/angular/angular/blob/8f24bc9443b3872fe095d9f7f77b308a361a13b4/docs/GITHUB_PROCESS.md#conversation-locking
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Apr 23, 2024https://github.com/angular/angular/issues/35119#event-12567227754
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/35119
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/35119
P4A relatively minor issue that is not relevant to core functionshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P4%22
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
breaking changeshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22breaking%20changes%22
core: inputs / outputshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20inputs%20%2F%20outputs%22
cross-cutting: typeshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22cross-cutting%3A%20types%22
freq1: lowhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22freq1%3A%20low%22
state: confirmedhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20confirmed%22
state: has PRhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20has%20PR%22
type: bug/fixhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%2Ffix%22
BacklogNo due datehttps://github.com/angular/angular/milestone/82
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.