René's URL Explorer Experiment


Title: Design Meeting Notes, 1/25/2019 · Issue #29588 · microsoft/TypeScript · GitHub

Open Graph Title: Design Meeting Notes, 1/25/2019 · Issue #29588 · microsoft/TypeScript

X Title: Design Meeting Notes, 1/25/2019 · Issue #29588 · microsoft/TypeScript

Description: Type parameters constrained to any #29571 We've had a test since forever, but TypeScript provides absolutely zero validation on usages of type parameter constrained to any. const f = (arg: T) => { arg.whut; // no error!!!!...

Open Graph Description: Type parameters constrained to any #29571 We've had a test since forever, but TypeScript provides absolutely zero validation on usages of type parameter constrained to any. const f =

X Description: Type parameters constrained to any #29571 We've had a test since forever, but TypeScript provides absolutely zero validation on usages of type parameter constrained to any. const f = <T exte...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Design Meeting Notes, 1/25/2019","articleBody":"# Type parameters constrained to `any`\r\n\r\nhttps://github.com/Microsoft/TypeScript/pull/29571\r\n\r\n* We've had a test since forever, but TypeScript provides absolutely zero validation on usages of type parameter constrained to `any`.\r\n\r\n```ts\r\nconst f = \u003cT extends any\u003e(arg: T) =\u003e {\r\n    arg.whut; // no error!!!!!\r\n}\r\n```\r\n\r\n* How often does this come up in practice?\r\n    * When an error message says \"this isn't assignable to this constraint\", then you can imagine people just \r\n* Depends on who gets impacted.\r\n    * Check [bigtestquery](https://bigtsquery.firebaseapp.com/query?selector=TypeParameter%3EAnyKeyword), other real world code.\r\n* Seems like this could break behavior in the presence of what TypeScript falls back to in failed inferences.\r\n    * Nope! We see if the inferred type is assignable to the constraint, and fall back to the constraint if not. Since we infer `{}` in the presence of no inferences and that's assignable to `any`, that's okay.\r\n\r\n# Apply contextual types from inferred return types\r\n\r\nhttps://github.com/Microsoft/TypeScript/pull/29478\r\n\r\n* Seems low risk - let's see if tests come back, and if so everything can go in for 3.3.\r\n\r\n# `const` contexts\r\n\r\nhttps://github.com/Microsoft/TypeScript/pull/29510\r\n\r\nSeems like there was some confusion on naming, but looks reasonable.\r\n\r\n# Improved simplification and restrictive instantiation of conditionals\r\n\r\n#29437\r\n\r\n* Doesn't `T extend U` always being true always imply that `T` subsumes `T \u0026 U` anyway?\r\n    * Mostly yes! But in the presence of circularities.\r\n* Right now this emulates what negated types *would* do.\r\n* Do we want this in 3.3?\r\n    * No, not the whole thing.\r\n    * The restrictive instantiation is helpful.\r\n* Rename some function as part of the PR 🤷‍♂️.\r\n\r\n# Unioning issues on thousands of object literals\r\n\r\nhttps://github.com/Microsoft/TypeScript/pull/28707\r\nhttps://github.com/Microsoft/TypeScript/pull/28727\r\n\r\n* Dualing PRs\r\n* Array literals with 30K distinct object literals\r\n* This isn't 3.3 bound\r\n    * It's been terrible since normalization\r\n    * It's been slow since union types\r\n    * Probably as bad when we used to fall back to `{}`.\r\n\r\n# Negated types\r\n\r\n#29317\r\n\r\n* Want to see how it affects control flow, and first want to look into index signature unification.\r\n\r\n# Index signatures\r\n\r\n#26797\r\n\r\n* Need to unify the idea of mapped types and index signatures.\r\n* Maybe the idea here is that existing index signatures continue to work the way they do today, and any declarations of normal properties (i.e. using unions of literal types) don't have to apply.\r\n    * How do you fall into this scenario?\r\n\r\n      ```ts\r\n      let foo: {\r\n          [x: \"a\" | \"b\" | \"c\"]: boolean;\r\n          [x: \"c\" | \"d\" | \"e\"]: number;\r\n      };\r\n\r\n\r\n      ```\r\n* Could muse about a world where every property declaration `\"foo\"` with type `T` de-sugars to `[x: \"foo\"]: T`.\r\n    * With that, negated types mean you can also ensure that certain properties can be excluded from needing to satisfy index signatures.\r\n\r\n# Contextually typed parameters with binding patterns\r\n\r\n#28816\r\n\r\n* Today, when we have to determine the type of a parameter, we ask\r\n    1. Is there an annotation?\r\n    1. Is there a contextual type?\r\n    1. Is there an initializer?\r\n    1. Can we build a type *implied* by the binding pattern?\r\n* When you have a contextual type, but that contextual type is a type parameter in inference, then you run into an awkward loop.\r\n    * What we arguably *should* do is say that contextual typing fixes the type parameter, and if the type parameter isn't constrained then you get inference to `{}`.\r\n    * What we instead to is say there's no contextual type, try to infer from the binding pattern, and then infer to the type parameter.\r\n* Turns out this has inconsistent experiences in the IDE.\r\n* This is a breaking change under `noImplicitAny`, but we need to make a call\r\n\r\n# Different treatment of methods, functions expressions, and arrow functions\r\n\r\n#29520\r\n\r\n* In order to \"validate\" an instantiation of `T`\r\n* The subtle difference is that 0-arity arrow functions are the only ones that are not contextually sensitive.\r\n    * Sure it is!\r\n    * Nope! It has no `this` parameter. The others do.\r\n    * So the others are contextually sensitive and deferred.\r\n* There's an expensive way to solve the problem.\r\n    * We could clone the type mapper and not \"fix\" the type parameters during inference.\r\n    * We can track whether the node itself contains `this`.\r\n* Could potentially see if we could make it cheaper to clone mappers.\r\n    * But couldn't that fix other parameters?\r\n        * \\[\\[Potentially not - @weswigham @ahejlsberg, why?]]\r\n* Possibly a design limitation, but may be interesting to tackle.\r\n* A better pattern might just be to use negated types.\r\n\r\n# Invariant predicates\r\n\r\n#26981\r\n#27686\r\n\r\n* Technically, user-defined type guards should be invariant.\r\n* Unfortunately this breaks a bunch of things that appear reasonable in real world code.\r\n* Error with `{}` to `any` because uses `isIdenticalTo`.","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2019-01-25T21:26:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/29588/TypeScript/issues/29588"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:bd0cadc5-3219-c256-f2f9-cc9b8964e36c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD08C:1166E6:DDF5E0:128D84B:6A62B550
html-safe-nonceca25f401771e8b75cabe047ea4e9ed0eccd159cfdc67e9113326b8434e15ff82
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDhDOjExNjZFNjpEREY1RTA6MTI4RDg0Qjo2QTYyQjU1MCIsInZpc2l0b3JfaWQiOiI0MzA5MjYyNTM4MDgzODQxMzYwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac43ee52a5bfe42b32bd1ee19a5e522f7115488d19b20c4f9e5464e9014d14226d
hovercard-subject-tagissue:403339155
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/29588/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5a7378543ba8c19d29aa499d1cd23c476dbd5d6a665fd550a2ab093417c9452a/microsoft/TypeScript/issues/29588
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5a7378543ba8c19d29aa499d1cd23c476dbd5d6a665fd550a2ab093417c9452a/microsoft/TypeScript/issues/29588
og:image:altType parameters constrained to any #29571 We've had a test since forever, but TypeScript provides absolutely zero validation on usages of type parameter constrained to any. const f =
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameDanielRosenwasser
hostnamegithub.com
expected-hostnamegithub.com
None2738d7125e864b55224a8bc40c72c220ca7d2c73f91a7bb8d69dffe9d35e997d
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
releasebf54af498459157b66a67136f992a68752cdbb54
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/29588#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F29588
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%2F29588
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/29588
Reloadhttps://github.com/microsoft/TypeScript/issues/29588
Reloadhttps://github.com/microsoft/TypeScript/issues/29588
Please reload this pagehttps://github.com/microsoft/TypeScript/issues/29588
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
Design Meeting Notes, 1/25/2019https://github.com/microsoft/TypeScript/issues/29588#top
Design NotesNotes from our design meetingshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Design%20Notes%22
https://github.com/DanielRosenwasser
DanielRosenwasserhttps://github.com/DanielRosenwasser
on Jan 25, 2019https://github.com/microsoft/TypeScript/issues/29588#issue-403339155
#29571https://github.com/microsoft/TypeScript/pull/29571
bigtestqueryhttps://bigtsquery.firebaseapp.com/query?selector=TypeParameter%3EAnyKeyword
#29478https://github.com/microsoft/TypeScript/pull/29478
#29510https://github.com/microsoft/TypeScript/pull/29510
#29437https://github.com/microsoft/TypeScript/pull/29437
#28707https://github.com/microsoft/TypeScript/pull/28707
#28727https://github.com/microsoft/TypeScript/pull/28727
#29317https://github.com/microsoft/TypeScript/pull/29317
#26797https://github.com/microsoft/TypeScript/pull/26797
#28816https://github.com/microsoft/TypeScript/issues/28816
#29520https://github.com/microsoft/TypeScript/issues/29520
@weswighamhttps://github.com/weswigham
@ahejlsberghttps://github.com/ahejlsberg
#26981https://github.com/microsoft/TypeScript/issues/26981
#27686https://github.com/microsoft/TypeScript/pull/27686
Design NotesNotes from our design meetingshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Design%20Notes%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.