René's URL Explorer Experiment


Title: Wrong type inferred for indirect call of generic function · Issue #29638 · microsoft/TypeScript · GitHub

Open Graph Title: Wrong type inferred for indirect call of generic function · Issue #29638 · microsoft/TypeScript

X Title: Wrong type inferred for indirect call of generic function · Issue #29638 · microsoft/TypeScript

Description: TypeScript Version: 3.2.2 Search Terms: Generics, lookahead, type inference Code function call(f: (p1: P1) => R, p1: P1): R { return f(p1); } function identity(o: T): T { return o; } const x = call(identity, 1); // When the par...

Open Graph Description: TypeScript Version: 3.2.2 Search Terms: Generics, lookahead, type inference Code function call(f: (p1: P1) => R, p1: P1): R { return f(p1); } function identity(o: T): T { return o; } cons...

X Description: TypeScript Version: 3.2.2 Search Terms: Generics, lookahead, type inference Code function call<P1, R>(f: (p1: P1) => R, p1: P1): R { return f(p1); } function identity<T>(o: T): T { r...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Wrong type inferred for indirect call of generic function ","articleBody":"**TypeScript Version:** 3.2.2\r\n\r\n**Search Terms:** Generics, lookahead, type inference\r\n\r\n**Code**\r\n\r\n```ts\r\nfunction call\u003cP1, R\u003e(f: (p1: P1) =\u003e R, p1: P1): R {\r\n    return f(p1);\r\n}\r\n\r\nfunction identity\u003cT\u003e(o: T): T {\r\n    return o;\r\n}\r\n\r\nconst x = call(identity, 1);\r\n\r\n\r\n// When the parameters are reversed, it works:\r\n\r\nfunction callReversed\u003cP1, R\u003e(p1: P1, f: (p1: P1) =\u003e R): R {\r\n    return f(p1);\r\n}\r\n\r\nconst y = callReversed(1, identity);\r\n```\r\n\r\n\r\n\r\n**Expected behavior:**\r\n\r\n`x` is of type `number`\r\n\r\n**Actual behavior:**\r\n\r\n`x` is of type `{}`\r\nonly `y` is of type number\r\n\r\n**Playground Link:** [Playground link](https://www.typescriptlang.org/play/#src=function%20call%3CP1%2C%20R%3E(f%3A%20(p1%3A%20P1)%20%3D%3E%20R%2C%20p1%3A%20P1)%3A%20R%20%7B%0A%20%20%20%20return%20f(p1)%3B%0A%7D%0A%0Afunction%20identity%3CT%3E(o%3A%20T)%3A%20T%20%7B%0A%20%20%20%20return%20o%3B%0A%7D%0A%0Aconst%20x%20%3D%20call(identity%2C%201)%3B%0A%0A%0A%2F%2F%20Reversed%3A%0A%0Afunction%20callReversed%3CP1%2C%20R%3E(p1%3A%20P1%2C%20f%3A%20(p1%3A%20P1)%20%3D%3E%20R)%3A%20R%20%7B%0A%20%20%20%20return%20f(p1)%3B%0A%7D%0A%0Aconst%20y%20%3D%20callReversed(1%2C%20identity)%3B%0A)\r\n\r\n**Related Issues:** I didn't find anything related, but maybe I have been using the wrong search term (\"lookahead\").\r\n","author":{"url":"https://github.com/tp","@type":"Person","name":"tp"},"datePublished":"2019-01-29T18:47:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/29638/TypeScript/issues/29638"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:3b281447-736e-b2b9-32dd-89d5f8f7f8bf
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id819C:A1BA4:5C5088:7D3769:6A627D11
html-safe-nonce7965a483a6ad606833e1f64481aac2d13f989c2ea4fb95b20c1f89085a3a3045
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTlDOkExQkE0OjVDNTA4ODo3RDM3Njk6NkE2MjdEMTEiLCJ2aXNpdG9yX2lkIjoiNTQ5NjA3MzA2MTIzMjk2NjkyOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac27929b11ddafb04e19646d2da4b1dfefcac2a5a225f0104b73635a034753bec4
hovercard-subject-tagissue:404434172
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/29638/issue_layout
twitter:imagehttps://opengraph.githubassets.com/02ec490c80e650e2e1465f340a8a0d1f32b0ff7f42869ad671e0be848b4cd29a/microsoft/TypeScript/issues/29638
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/02ec490c80e650e2e1465f340a8a0d1f32b0ff7f42869ad671e0be848b4cd29a/microsoft/TypeScript/issues/29638
og:image:altTypeScript Version: 3.2.2 Search Terms: Generics, lookahead, type inference Code function call(f: (p1: P1) => R, p1: P1): R { return f(p1); } function identity(o: T): T { return o; } cons...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametp
hostnamegithub.com
expected-hostnamegithub.com
None54d77223ecd96549586d00f1e91ee7d05feebf27ea430279a9c4ba4b7de1a93c
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
release4d79f1b99472a521fc5fb66e9fdc3ce742937dff
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/29638#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F29638
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F29638
Sign up https://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/29638
Reloadhttps://github.com/microsoft/TypeScript/issues/29638
Reloadhttps://github.com/microsoft/TypeScript/issues/29638
Please reload this pagehttps://github.com/microsoft/TypeScript/issues/29638
microsoft https://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Notifications https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Fork 13.6k https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Star 110k https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Code https://github.com/microsoft/TypeScript
Issues 5k+ https://github.com/microsoft/TypeScript/issues
Pull requests 21 https://github.com/microsoft/TypeScript/pulls
Actions https://github.com/microsoft/TypeScript/actions
Projects https://github.com/microsoft/TypeScript/projects
Models https://github.com/microsoft/TypeScript/models
Wiki https://github.com/microsoft/TypeScript/wiki
Security and quality 0 https://github.com/microsoft/TypeScript/security
Insights https://github.com/microsoft/TypeScript/pulse
Code https://github.com/microsoft/TypeScript
Issues https://github.com/microsoft/TypeScript/issues
Pull requests https://github.com/microsoft/TypeScript/pulls
Actions https://github.com/microsoft/TypeScript/actions
Projects https://github.com/microsoft/TypeScript/projects
Models https://github.com/microsoft/TypeScript/models
Wiki https://github.com/microsoft/TypeScript/wiki
Security and quality https://github.com/microsoft/TypeScript/security
Insights https://github.com/microsoft/TypeScript/pulse
Wrong type inferred for indirect call of generic function https://github.com/microsoft/TypeScript/issues/29638#top
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
https://github.com/tp
tphttps://github.com/tp
on Jan 29, 2019https://github.com/microsoft/TypeScript/issues/29638#issue-404434172
Playground linkhttps://www.typescriptlang.org/play/#src=function%20call%3CP1%2C%20R%3E(f%3A%20(p1%3A%20P1)%20%3D%3E%20R%2C%20p1%3A%20P1)%3A%20R%20%7B%0A%20%20%20%20return%20f(p1)%3B%0A%7D%0A%0Afunction%20identity%3CT%3E(o%3A%20T)%3A%20T%20%7B%0A%20%20%20%20return%20o%3B%0A%7D%0A%0Aconst%20x%20%3D%20call(identity%2C%201)%3B%0A%0A%0A%2F%2F%20Reversed%3A%0A%0Afunction%20callReversed%3CP1%2C%20R%3E(p1%3A%20P1%2C%20f%3A%20(p1%3A%20P1)%20%3D%3E%20R)%3A%20R%20%7B%0A%20%20%20%20return%20f(p1)%3B%0A%7D%0A%0Aconst%20y%20%3D%20callReversed(1%2C%20identity)%3B%0A
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%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.