René's URL Explorer Experiment


Title: [Feature Request] Built in to make a type non-nullable · Issue #1874 · AssemblyScript/assemblyscript · GitHub

Open Graph Title: [Feature Request] Built in to make a type non-nullable · Issue #1874 · AssemblyScript/assemblyscript

X Title: [Feature Request] Built in to make a type non-nullable · Issue #1874 · AssemblyScript/assemblyscript

Description: Consider the following example: function takesGeneric(t: T): void { if (!isNullable() || t != null){ // @ts-ignore if (isDefined(t.call)){ t.call() } } } function callsGeneric(t: T): void { if (t != null) { takesGeneric(t); // W...

Open Graph Description: Consider the following example: function takesGeneric(t: T): void { if (!isNullable() || t != null){ // @ts-ignore if (isDefined(t.call)){ t.call() } } } function callsGeneric(t: T): void ...

X Description: Consider the following example: function takesGeneric<T>(t: T): void { if (!isNullable<T>() || t != null){ // @ts-ignore if (isDefined(t.call)){ t.call() } } } function callsGeneric<...

Opengraph URL: https://github.com/AssemblyScript/assemblyscript/issues/1874

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Feature Request] Built in to make a type non-nullable","articleBody":"[Consider the following example:](https://www.assemblyscript.org/editor.html#IyFvcHRpbWl6ZT1zcGVlZCZydW50aW1lPXN0dWIKLyoqIENhbGN1bGF0ZXMgdGhlIG4tdGggRmlib25hY2NpIG51bWJlci4gKi8KZXhwb3J0IGZ1bmN0aW9uIGZpYihuOiBpMzIpOiBpMzIgewogIHZhciBhID0gMCwgYiA9IDEKICBpZiAobiA+IDApIHsKICAgIHdoaWxlICgtLW4pIHsKICAgICAgbGV0IHQgPSBhICsgYgogICAgICBhID0gYgogICAgICBiID0gdAogICAgfQogICAgcmV0dXJuIGIKICB9CiAgcmV0dXJuIGEKfQoKZnVuY3Rpb24gdGFrZXNHZW5lcmljPFQ+KHQ6IFQpOiB2b2lkIHsKICBpZiAoIWlzTnVsbGFibGU8VD4oKSB8fCB0ICE9IG51bGwpewogICAgICAvLyBAdHMtaWdub3JlCiAgICAgIGlmICAoaXNEZWZpbmVkKHQuY2FsbCkpewogICAgICAgIHQuY2FsbCgpCiAgICAgIH0KICAgIH0KfQoKZnVuY3Rpb24gY2FsbHNHZW5lcmljPFQ+KHQ6IFQpOiB2b2lkIHsKICBpZiAodCAhPSBudWxsKSB7CiAgICB0YWtlc0dlbmVyaWModCk7CiAgfQp9CgpjbGFzcyBUZWUgewogIGNhbGwoKTogdm9pZCB7CiAgICBsZXQgeDogaTggPSAwOwogIH0KfQoKbGV0IHk6IFRlZSB8IG51bGwgPSBuZXcgVGVlKCk7CgpjYWxsc0dlbmVyaWMoeSk7CiMhaHRtbAo8dGV4dGFyZWEgaWQ9Im91dHB1dCIgc3R5bGU9ImhlaWdodDogMTAwJTsgd2lkdGg6IDEwMCUiIHJlYWRvbmx5PjwvdGV4dGFyZWE+CjxzY3JpcHQ+CmxvYWRlci5pbnN0YW50aWF0ZShtb2R1bGVfd2FzbSwgeyAvKiBpbXBvcnRzICovIH0pCiAgLnRoZW4oKHsgZXhwb3J0cyB9KSA9PiB7CiAgICBjb25zdCBvdXRwdXQgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnb3V0cHV0JykKICAgIGZvciAobGV0IGkgPSAwOyBpIDw9IDEwOyArK2kpIHsKICAgICAgb3V0cHV0LnZhbHVlICs9IGBmaWIoJHtpfSkgPSAke2V4cG9ydHMuZmliKGkpfVxuYAogICAgfQogIH0pCjwvc2NyaXB0Pg==)\r\n\r\n```ts\r\n\r\nfunction takesGeneric\u003cT>(t: T): void {\r\n  if (!isNullable\u003cT>() || t != null){\r\n      // @ts-ignore\r\n      if  (isDefined(t.call)){\r\n        t.call()\r\n      }\r\n    }\r\n}\r\n\r\nfunction callsGeneric\u003cT>(t: T): void {\r\n  if (t != null) {\r\n    takesGeneric(t); // Would be nice to have a `notNull\u003cT>` here\r\n  }\r\n}\r\n\r\nclass Tee {\r\n  call(): void {\r\n    let x: i8 = 0;\r\n  }\r\n}\r\n\r\nlet y: Tee | null = new Tee();\r\n\r\ncallsGeneric(y);\r\n```\r\n\r\nThe type passed to `takesGeneric` is no longer nullable since it's guaranteed to not be null. However, the type passed doesn't reflect this.  A quick fix to this could be to add a new builtin that converts a `type | null` to `type`.  Or in branches where the type is non-null this happens automatically.","author":{"url":"https://github.com/willemneal","@type":"Person","name":"willemneal"},"datePublished":"2021-05-28T17:57:40Z","url":"https://github.com/AssemblyScript/assemblyscript/issues/1874"}

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:6509d818-5af8-ba84-4446-7498d9f1184f
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8928:21149E:DDB596:12F670D:6B00B4F8
html-safe-nonce7b4a523be6d2a876495550f903e933efd4270b984fd38babeb4616315bc9ce80
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTI4OjIxMTQ5RTpEREI1OTY6MTJGNjcwRDo2QjAwQjRGOCIsInZpc2l0b3JfaWQiOiIyNzE2NTc2NTY2MDkwOTcwMzYwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacd96ed19d4467839774424edc89e07ff7f6df80ff05280feda039430e541290dd
hovercard-subject-tagissue:905821484
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/AssemblyScript/assemblyscript/1874/issue_layout
twitter:imagehttps://opengraph.githubassets.com/aba3bb567bea4a2a443b625ca5823a4590639432a69d32c468308f5d1e590b15/AssemblyScript/assemblyscript/issues/1874
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/aba3bb567bea4a2a443b625ca5823a4590639432a69d32c468308f5d1e590b15/AssemblyScript/assemblyscript/issues/1874
og:image:altConsider the following example: function takesGeneric(t: T): void { if (!isNullable() || t != null){ // @ts-ignore if (isDefined(t.call)){ t.call() } } } function callsGeneric(t: T): void ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamewillemneal
hostnamegithub.com
expected-hostnamegithub.com
None1d07c25977adfc5ff6acb0a962a9bc168c07afbda6fef765f9761c350c2ae4a2
turbo-cache-controlno-preview
go-importgithub.com/AssemblyScript/assemblyscript git https://github.com/AssemblyScript/assemblyscript.git
octolytics-dimension-user_id28916798
octolytics-dimension-user_loginAssemblyScript
octolytics-dimension-repository_id105138356
octolytics-dimension-repository_nwoAssemblyScript/assemblyscript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id105138356
octolytics-dimension-repository_network_root_nwoAssemblyScript/assemblyscript
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
release5429cbfc6aca8c7b9a086a3c8f47400346f38cc9
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/AssemblyScript/assemblyscript/issues/1874#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FAssemblyScript%2Fassemblyscript%2Fissues%2F1874
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%2FAssemblyScript%2Fassemblyscript%2Fissues%2F1874
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=AssemblyScript%2Fassemblyscript
Reloadhttps://github.com/AssemblyScript/assemblyscript/issues/1874
Reloadhttps://github.com/AssemblyScript/assemblyscript/issues/1874
Reloadhttps://github.com/AssemblyScript/assemblyscript/issues/1874
AssemblyScripthttps://github.com/AssemblyScript
assemblyscripthttps://github.com/AssemblyScript/assemblyscript
Codehttps://github.com/AssemblyScript/assemblyscript
Issues196 (196)https://github.com/AssemblyScript/assemblyscript/issues
Pull requests24 (24)https://github.com/AssemblyScript/assemblyscript/pulls
Actionshttps://github.com/AssemblyScript/assemblyscript/actions
Wikihttps://github.com/AssemblyScript/assemblyscript/wiki
Security and qualityhttps://github.com/AssemblyScript/assemblyscript/security
Insightshttps://github.com/AssemblyScript/assemblyscript/insights
https://github.com/AssemblyScript/assemblyscript
New issuehttps://github.com/login?return_to=https://github.com/AssemblyScript/assemblyscript/issues/1874
New issuehttps://github.com/login?return_to=https://github.com/AssemblyScript/assemblyscript/issues/1874
#1875https://github.com/AssemblyScript/assemblyscript/pull/1875
[Feature Request] Built in to make a type non-nullablehttps://github.com/AssemblyScript/assemblyscript/issues/1874#top
#1875https://github.com/AssemblyScript/assemblyscript/pull/1875
enhancementhttps://github.com/AssemblyScript/assemblyscript/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com/willemneal
willemnealhttps://github.com/willemneal
on May 28, 2021https://github.com/AssemblyScript/assemblyscript/issues/1874#issue-905821484
Consider the following example:https://www.assemblyscript.org/editor.html#IyFvcHRpbWl6ZT1zcGVlZCZydW50aW1lPXN0dWIKLyoqIENhbGN1bGF0ZXMgdGhlIG4tdGggRmlib25hY2NpIG51bWJlci4gKi8KZXhwb3J0IGZ1bmN0aW9uIGZpYihuOiBpMzIpOiBpMz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pg==
https://github.com/MaxGraey
MaxGraeyhttps://github.com/MaxGraey
on May 28, 2021https://github.com/AssemblyScript/assemblyscript/issues/1874#issuecomment-850581138
MaxGraeyhttps://github.com/MaxGraey
enhancementhttps://github.com/AssemblyScript/assemblyscript/issues?q=state%3Aopen%20label%3A%22enhancement%22
on May 28, 2021https://github.com/AssemblyScript/assemblyscript/issues/1874#event-4814026388
dcodeIOhttps://github.com/dcodeIO
completedhttps://github.com/AssemblyScript/assemblyscript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#1875https://github.com/AssemblyScript/assemblyscript/pull/1875
on Jun 8, 2021https://github.com/AssemblyScript/assemblyscript/issues/1874#event-4860010436
Sign up for freehttps://github.com/signup?return_to=https://github.com/AssemblyScript/assemblyscript/issues/1874
Sign in to commenthttps://github.com/login?return_to=https://github.com/AssemblyScript/assemblyscript/issues/1874
enhancementhttps://github.com/AssemblyScript/assemblyscript/issues?q=state%3Aopen%20label%3A%22enhancement%22
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.