René's URL Explorer Experiment


Title: Type narrowing not applied for nested types when passing to function · Issue #62525 · microsoft/TypeScript · GitHub

Open Graph Title: Type narrowing not applied for nested types when passing to function · Issue #62525 · microsoft/TypeScript

X Title: Type narrowing not applied for nested types when passing to function · Issue #62525 · microsoft/TypeScript

Description: 🔎 Search Terms discriminant property, ... 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about type narrowing ⏯ Playground Link https://www.typescriptlang.org/play/?ts...

Open Graph Description: 🔎 Search Terms discriminant property, ... 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about type narrowing ⏯ Playground Link...

X Description: 🔎 Search Terms discriminant property, ... 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about type narrowing ⏯ Playground ...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/62525

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Type narrowing not applied for nested types when passing to function","articleBody":"### 🔎 Search Terms\n\ndiscriminant property, ...\n\n### 🕗 Version & Regression Information\n\n- This is the behavior in every version I tried, and I reviewed the FAQ for entries about type narrowing\n\n\n### ⏯ Playground Link\n\nhttps://www.typescriptlang.org/play/?ts=6.0.0-dev.20251001#code/C4TwDgpgBAogdsAlqKBeAUFKAfKBvTLI0SALigCIB7OCCgbkKKjgEMBbCcgZ2ACdEcAOY4WAVwA2ExswC+hXAWZYSXSsADuVBkyJtOPfoJG44k6bvlZcYuABMIAM0EQ7jdI9sBjJDRYcIACUIAEcxRD5XAAo1PH8DKF4BYShZAEp8eU84H0Q-JONgsIjopPJEo2EMvHkPb184KGAIXhjyeCRQasJERygYqAAyQagIADp9CG7mAuEi8Mi7GImAtPdmSfmSpamZPQCtxYHWbibwCCo+6BG8SfJVS9GVznS9+XkgA\n\n### 💻 Code\n\n```ts\ntype Entity =\n  | {\n      type: \"one\";\n      name: string | null;\n    }\n  | {\n      type: \"two\";\n      name: string | null;\n    }\n  | undefined;\n\nfunction nameRequired(e: { name: string }) {}\nfunction stringRequired(str:  string) {}\n\nfunction test(e: Entity) {\n  if (e && e.name) {\n    stringRequired(e.name);\n\n    // Fails\n    nameRequired(e);\n\n    // Which seemingly has the same types as the above, succeeds.\n    nameRequired(e as typeof e & {name: typeof e.name});\n  }\n}\n```\n\n\n### 🙁 Actual behavior\n\nReports a type error:\n```\nArgument of type '{ type: \"one\"; name: string | null; } | { type: \"two\"; name: string | null; }' is not assignable to parameter of type '{ name: string; }'.\n  Type '{ type: \"one\"; name: string | null; }' is not assignable to type '{ name: string; }'.\n    Types of property 'name' are incompatible.\n      Type 'string | null' is not assignable to type 'string'.\n        Type 'null' is not assignable to type 'string'.\n```\n\n### 🙂 Expected behavior\n\nShould not report a type error.\n\n### Additional information about the issue\n\nIssues I've found that could possibly be related:\n* https://github.com/microsoft/TypeScript/issues/53202\n* https://github.com/microsoft/TypeScript/issues/18758","author":{"url":"https://github.com/SimonSimCity","@type":"Person","name":"SimonSimCity"},"datePublished":"2025-10-02T07:39:18Z","url":"https://github.com/microsoft/TypeScript/issues/62525"}

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:6d48bce4-2f38-893f-f958-7966c0b14104
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAEE4:928E2:BCFC73:FDA4B7:6B00F776
html-safe-nonceefe58606caf83c361e98eb10a4c9f715eaad9d9b65926f9a321a657fdcf66c99
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRUU0OjkyOEUyOkJDRkM3MzpGREE0Qjc6NkIwMEY3NzYiLCJ2aXNpdG9yX2lkIjoiNzY4NTU0NDY5NjA3NjEwNTU5MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacf2262abd52b9dc35539eb9eb61cc17790a7fedf161c3bf5ea4e7b50eb291c9c6
hovercard-subject-tagissue:3476436219
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/microsoft/TypeScript/62525/issue_layout
twitter:imagehttps://opengraph.githubassets.com/62944520ba241f29b7045affbb5a1da4efe71fa0edcaa572cafd1ef1b69f7381/microsoft/TypeScript/issues/62525
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/62944520ba241f29b7045affbb5a1da4efe71fa0edcaa572cafd1ef1b69f7381/microsoft/TypeScript/issues/62525
og:image:alt🔎 Search Terms discriminant property, ... 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about type narrowing ⏯ Playground Link...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameSimonSimCity
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
turbo-cache-controlno-preview
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
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
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/62525#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F62525
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%2Fmicrosoft%2FTypeScript%2Fissues%2F62525
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=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/62525
Reloadhttps://github.com/microsoft/TypeScript/issues/62525
Reloadhttps://github.com/microsoft/TypeScript/issues/62525
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests309 (309)https://github.com/microsoft/TypeScript/pulls
Actionshttps://github.com/microsoft/TypeScript/actions
Projectshttps://github.com/microsoft/TypeScript/projects
Wikihttps://github.com/microsoft/TypeScript/wiki
Security and qualityhttps://github.com/microsoft/TypeScript/security
Insightshttps://github.com/microsoft/TypeScript/insights
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/62525
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/62525
Type narrowing not applied for nested types when passing to functionhttps://github.com/microsoft/TypeScript/issues/62525#top
https://github.com/SimonSimCity
Simon Schick (SimonSimCity)https://github.com/SimonSimCity
on Oct 2, 2025https://github.com/microsoft/TypeScript/issues/62525#issue-3476436219
https://www.typescriptlang.org/play/?ts=6.0.0-dev.20251001#code/C4TwDgpgBAogdsAlqKBeAUFKAfKBvTLI0SALigCIB7OCCgbkKKjgEMBbCcgZ2ACdEcAOY4WAVwA2ExswC+hXAWZYSXSsADuVBkyJtOPfoJG44k6bvlZcYuABMIAM0EQ7jdI9sBjJDRYcIACUIAEcxRD5XAAo1PH8DKF4BYShZAEp8eU84H0Q-JONgsIjopPJEo2EMvHkPb184KGAIXhjyeCRQasJERygYqAAyQagIADp9CG7mAuEi8Mi7GImAtPdmSfmSpamZPQCtxYHWbibwCCo+6BG8SfJVS9GVznS9+XkgAhttps://www.typescriptlang.org/play/?ts=6.0.0-dev.20251001#code/C4TwDgpgBAogdsAlqKBeAUFKAfKBvTLI0SALigCIB7OCCgbkKKjgEMBbCcgZ2ACdEcAOY4WAVwA2ExswC+hXAWZYSXSsADuVBkyJtOPfoJG44k6bvlZcYuABMIAM0EQ7jdI9sBjJDRYcIACUIAEcxRD5XAAo1PH8DKF4BYShZAEp8eU84H0Q-JONgsIjopPJEo2EMvHkPb184KGAIXhjyeCRQasJERygYqAAyQagIADp9CG7mAuEi8Mi7GImAtPdmSfmSpamZPQCtxYHWbibwCCo+6BG8SfJVS9GVznS9+XkgA
Cascade type narrowing to child constants #53202https://github.com/microsoft/TypeScript/issues/53202
Nested Tagged Unions #18758https://github.com/microsoft/TypeScript/issues/18758
https://github.com/MartinJohns
Martin Johns (MartinJohns)https://github.com/MartinJohns
on Oct 2, 2025https://github.com/microsoft/TypeScript/issues/62525#issuecomment-3359780866
#42384https://github.com/microsoft/TypeScript/issues/42384
https://github.com/SimonSimCity
Simon Schick (SimonSimCity)https://github.com/SimonSimCity
on Oct 2, 2025https://github.com/microsoft/TypeScript/issues/62525#issuecomment-3360161858
Martin Johns (@MartinJohns)https://github.com/MartinJohns
#42384 (comment)https://github.com/microsoft/TypeScript/issues/42384#issuecomment-872906445
Simon Schick (SimonSimCity)https://github.com/SimonSimCity
duplicatehttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Aduplicate
Type guard should infer the type of parent object when applied on a property #42384https://github.com/microsoft/TypeScript/issues/42384
on Oct 2, 2025https://github.com/microsoft/TypeScript/issues/62525#event-20055250109
microsofthttps://github.com/microsoft
on Dec 1, 2025https://github.com/microsoft/TypeScript/issues/62525#event-21283433255
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/62525
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/62525
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.