René's URL Explorer Experiment


Title: AngularJs TypeScript typings and --strictFunctionTypes · Issue #16617 · angular/angular.js · GitHub

Open Graph Title: AngularJs TypeScript typings and --strictFunctionTypes · Issue #16617 · angular/angular.js

X Title: AngularJs TypeScript typings and --strictFunctionTypes · Issue #16617 · angular/angular.js

Description: I'm submitting a ... bug report feature request design discussion TypeScript introduced a new strictness flag with TS 2.7 - https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#strict-function-types It makes typechecki...

Open Graph Description: I'm submitting a ... bug report feature request design discussion TypeScript introduced a new strictness flag with TS 2.7 - https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#s...

X Description: I'm submitting a ... bug report feature request design discussion TypeScript introduced a new strictness flag with TS 2.7 - https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScri...

Opengraph URL: https://github.com/angular/angular.js/issues/16617

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"AngularJs TypeScript typings and --strictFunctionTypes","articleBody":"**I'm submitting a ...**\r\n\u003c!-- (check one with \"x\") -->\r\n- [ ] bug report\r\n- [ ] feature request\r\n- [x] design discussion \u003c!--(Please do not submit support requests here - see above)-->\r\n\r\nTypeScript introduced a new strictness flag with TS 2.7 - https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript#strict-function-types\r\n\r\nIt makes typechecking for callback based APIs much stricter. For example:\r\n\r\n```typescript\r\nfunction f(mixedArray: (string|number)[]) {\r\n  mixedArray.map((x: string) => x.charAt(0));\r\n}\r\n```\r\nonly errors when --strictFunctionTypes is turned on.\r\n\r\nAngularJs has many callback based APIs, which will be checked at more strictly with the flag. Some real bugs will be exposed, but also it will start erring on many correct patterns. For example:\r\n\r\n```typescript\r\n{\r\n  require: 'ngModel'\r\n  link: (...., controller: NgModelController) {...}\r\n```\r\n\r\nThis is now an error because TS doesn't know that require and link are related. As written the typings require one handle the full spectrum of options in the link function `IController | IController[] | {[key: string]: IController}`.\r\n\r\nTS types are quite expressive and @gkalpak and I tried to write up some prototype of typings that are aware of the link between require and link:\r\n\r\n```typescript\r\ninterface IDirective\u003cT extends string|string[]> {\r\n  link?: (x: LinkT\u003cT>) => void;\r\n  require?: T;\r\n}\r\n\r\ntype LinkT\u003cT> =\r\n    T extends string ? IController : T extends string[] ? IController[] : never;\r\n```\r\nBut even with full conditional types, it is impossible to extend this for user-defined directives.\r\n\r\nSo as plan B, I am going to contribute some nice type aliases to DefinitelyTyped ```type LinkFnControllerType = IController | IController[] | {[key: string]: IController}```\r\nand propose the canonical solution to be writing the link function as:\r\n\r\n```typescript\r\nlink: (..., controller: angular.LinkFnControllerType) => {\r\n  let myController = controller as MyControllerType;\r\n}\r\n```\r\n\r\nOne added benefit is that there is an explicit 'as' cast to remind the reader to check with the 'require' and controller statements.\r\n","author":{"url":"https://github.com/rkirov","@type":"Person","name":"rkirov"},"datePublished":"2018-06-28T00:25:50Z","url":"https://github.com/angular/angular.js/issues/16617"}

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:c2225328-7f12-a5ae-4a82-5808c16bd17c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9340:2F888F:64066F:90713C:6AFD7AD2
html-safe-nonced4adb8765c182e5179e4123184e2afc2498960a30a5bf431839bf75ef31a439e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzQwOjJGODg4Rjo2NDA2NkY6OTA3MTNDOjZBRkQ3QUQyIiwidmlzaXRvcl9pZCI6IjM5MjE3NjI1NTcwNjAwMjA5NDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac0a2739b12c49eceefe1179b5b001f8b3e5c3fe378d7db350347719cda1e1f2b6
hovercard-subject-tagissue:336432370
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.js/16617/issue_layout
twitter:imagehttps://opengraph.githubassets.com/18512e87f5d06087486dfda61c4a0b218d2f4bb483609f05863969becd34072c/angular/angular.js/issues/16617
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/18512e87f5d06087486dfda61c4a0b218d2f4bb483609f05863969becd34072c/angular/angular.js/issues/16617
og:image:altI'm submitting a ... bug report feature request design discussion TypeScript introduced a new strictness flag with TS 2.7 - https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#s...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamerkirov
hostnamegithub.com
expected-hostnamegithub.com
None544ff6b59bd215c4609120f6e334dbd0b00d34fb6f8bc03a476f72256998887e
turbo-cache-controlno-preview
go-importgithub.com/angular/angular.js git https://github.com/angular/angular.js.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id460078
octolytics-dimension-repository_nwoangular/angular.js
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id460078
octolytics-dimension-repository_network_root_nwoangular/angular.js
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
release71c92f8b27ec5e9aa6f6477b4e067a4727fc9edb
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular.js/issues/16617#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular.js%2Fissues%2F16617
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.js%2Fissues%2F16617
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.js
Reloadhttps://github.com/angular/angular.js/issues/16617
Reloadhttps://github.com/angular/angular.js/issues/16617
Reloadhttps://github.com/angular/angular.js/issues/16617
angularhttps://github.com/angular
angular.jshttps://github.com/angular/angular.js
Codehttps://github.com/angular/angular.js
Issues389 (389)https://github.com/angular/angular.js/issues
Pull requests72 (72)https://github.com/angular/angular.js/pulls
Actionshttps://github.com/angular/angular.js/actions
Projectshttps://github.com/angular/angular.js/projects
Wikihttps://github.com/angular/angular.js/wiki
Security and qualityhttps://github.com/angular/angular.js/security
Insightshttps://github.com/angular/angular.js/insights
https://github.com/angular/angular.js
AngularJs TypeScript typings and --strictFunctionTypeshttps://github.com/angular/angular.js/issues/16617#top
1.8.x - won't fixhttps://github.com/angular/angular.js/milestone/145
https://github.com/rkirov
rkirovhttps://github.com/rkirov
on Jun 28, 2018https://github.com/angular/angular.js/issues/16617#issue-336432370
https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript#strict-function-typeshttps://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript#strict-function-types
@gkalpakhttps://github.com/gkalpak
rkirovhttps://github.com/rkirov
on Jun 28, 2018https://github.com/angular/angular.js/issues/16617#event-1705197461
Introduce two new type aliases - LinkFnControllerType and RequireType.https://github.com/rkirov/DefinitelyTyped/commit/67132da7ee068b85a62ed5321a1550faee963138
67132dahttps://github.com/rkirov/DefinitelyTyped/commit/67132da7ee068b85a62ed5321a1550faee963138
(angular.js) Introduce type aliases LinkFnControllerType and RequireT…https://github.com/rkirov/DefinitelyTyped/commit/dcfb0385371cdc3959616403e847062608f296c2
dcfb038https://github.com/rkirov/DefinitelyTyped/commit/dcfb0385371cdc3959616403e847062608f296c2
https://github.com/gkalpak
gkalpakhttps://github.com/gkalpak
on Jun 28, 2018https://github.com/angular/angular.js/issues/16617#issuecomment-400980845
pochttp://www.typescriptlang.org/play/index.html#src=interface%20IController%20%7B%0D%0A%20%20%24onInit%3F()%3A%20void%3B%0D%0A%20%20%24onDestroy%3F()%3A%20void%3B%0D%0A%20%20%5Bs%3A%20string%5D%3A%20any%3B%0D%0A%7D%0D%0A%0D%0Ainterface%20INgModelController%20extends%20IController%20%7B%0D%0A%20%20%24modelValue%3A%20any%3B%0D%0A%20%20%24viewValue%3A%20string%3B%0D%0A%7D%0D%0A%0D%0Ainterface%20IKnownControllers%20%7B%0D%0A%20%20%2F%2F%20We%20can%20include%20all%20known%20built-in%20controllers%20here.%0D%0A%20%20%2F%2F%20The%20user%20will%20e%20able%20to%20expand%20the%20%22list%22%20with%20their%20own%20directives.%0D%0A%20%20ngModel%3A%20INgModelController%3B%0D%0A%7D%3B%0D%0A%0D%0Ainterface%20IDirective%3CT%20extends%20undefined%20%7C%20string%20%7C%20string%5B%5D%20%7C%20%7B%20%5Bkey%3A%20string%5D%3A%20string%20%7D%20%3D%20undefined%3E%20%7B%0D%0A%20%20require%3F%3A%20T%3B%0D%0A%20%20link%3F%3A%20(c%3A%20LinkController%3CT%3E)%20%3D%3E%20void%3B%0D%0A%7D%0D%0A%0D%0Atype%20LinkController%3CT%3E%20%3D%20T%20extends%20%7B%20%5Bkey%3A%20string%5D%3A%20string%20%7D%20%3F%0D%0A%20%20%7B%20%5Bkey%20in%20keyof%20T%5D%3A%20key%20extends%20keyof%20IKnownControllers%20%3F%20IKnownControllers%5Bkey%5D%20%3A%20IController%20%7D%20%3A%20T%20extends%20string%5B%5D%20%3F%0D%0A%20%20IController%5B%5D%20%3A%20T%20extends%20keyof%20IKnownControllers%20%3F%0D%0A%20%20IKnownControllers%5BT%5D%20%3A%0D%0A%20%20IController%3B%0D%0A%0D%0A%0D%0A%2F%2F%20----------%20----------%20----------%20%2F%2F%0D%0A%0D%0A%0D%0A%2F%2F%20DDO%20with%20no%20%60require%60.%0D%0Aconst%20foo%3A%20IDirective%20%3D%20%7B%0D%0A%20%20link%3A%20(c%20%2F*%20IController%20*%2F)%20%3D%3E%20undefined%2C%0D%0A%7D%3B%0D%0A%0D%0A%2F%2F%20DDO%20with%20string%20%60require%60.%0D%0Aconst%20bar%3A%20IDirective%3Cstring%3E%20%3D%20%7B%0D%0A%20%20require%3A%20'bar'%2C%0D%0A%20%20link%3A%20(c%20%2F*%20IController%20*%2F)%20%3D%3E%20undefined%2C%0D%0A%7D%3B%0D%0A%0D%0A%2F%2F%20DDO%20with%20array%20%60require%60.%0D%0Aconst%20baz%3A%20IDirective%3Cstring%5B%5D%3E%20%3D%20%7B%0D%0A%20%20require%3A%20%5B'baz1'%2C%20'baz2'%5D%2C%0D%0A%20%20link%3A%20(c%20%2F*%20IController%5B%5D%20*%2F)%20%3D%3E%20undefined%2C%0D%0A%7D%3B%0D%0A%0D%0A%2F%2F%20DDO%20with%20object%20%60require%60.%0D%0Aconst%20qux%3A%20IDirective%3C%7B%20%5Bkey%3A%20string%5D%3A%20string%20%7D%3E%20%3D%20%7B%0D%0A%20%20require%3A%20%7B%20qux%3A%20'qux'%20%7D%2C%0D%0A%20%20link%3A%20(c%20%2F*%20%7B%20%5Bx%3A%20string%5D%3A%20IController%20%7D%20*%2F)%20%3D%3E%20%7B%0D%0A%20%20%20%20const%20qux%20%3D%20c.qux%3B%0D%0A%20%20%20%20const%20boo%20%3D%20c.boo%3B%20%20%2F%2F%20No%20error%20%3A(%0D%0A%20%20%7D%2C%0D%0A%7D%3B%0D%0A%0D%0A%2F%2F%20DDO%20with%20typed%20object%20%60require%60.%0D%0Aconst%20quux%3A%20IDirective%3C%7B%20ngModel%3A%20string%20%7D%3E%20%3D%20%7B%0D%0A%20%20require%3A%20%7B%20ngModel%3A%20'ngModel'%20%7D%2C%0D%0A%20%20%2F%2F%20link%3A%20(c%3A%20INgModelController)%20%3D%3E%20undefined%2C%20%20%2F%2F%20Error%20%3A(%20(IController%20cannot%20be%20assign%20to%20INgModelController.)%0D%0A%20%20link%3A%20(c%20%2F*%20%7B%20ngModel%3A%20IController%20%7D%20*%2F)%20%3D%3E%20%7B%0D%0A%20%20%20%20const%20ngModel%20%3D%20c.ngModel%20as%20INgModelController%3B%0D%0A%20%20%20%20const%20boo%20%3D%20c.boo%3B%20%20%2F%2F%20Error%20%3A)%0D%0A%20%20%7D%2C%0D%0A%7D%3B%0D%0A%0D%0A%0D%0A%2F%2F%20DDO%20with%20string%20%60require%60%20of%20%22known%20controller%22.%0D%0Aconst%20dirWithNgModel%3A%20IDirective%3C'ngModel'%3E%20%3D%20%7B%0D%0A%20%20require%3A%20'ngModel'%2C%0D%0A%20%20link%3A%20(c%20%2F*%20INgModelController%20%7D%20*%2F)%20%3D%3E%20undefined%2C%0D%0A%7D%3B%0D%0A%0D%0A%2F%2F%20DDO%20with%20object%20%60require%60%20including%20%22known%20controller%22.%0D%0Aconst%20dirWithNgModel2%3A%20IDirective%3C%7B%20ngModel%3A%20string%20%7D%3E%20%3D%20%7B%0D%0A%20%20require%3A%20%7B%20ngModel%3A%20'ngModel'%20%7D%2C%0D%0A%20%20link%3A%20(c%20%2F*%20%7B%20ngModel%3A%20INgModelController%20%7D%20*%2F)%20%3D%3E%20undefined%2C%0D%0A%7D%3B%0D%0A%0D%0A%0D%0A%2F%2F%20Extending%20%60IKnownControllers%60%20at%20runtime.%0D%0Ainterface%20IMyDirController%20extends%20IController%20%7B%0D%0A%20%20owner%3A%20'me'%3B%0D%0A%7D%0D%0A%0D%0Ainterface%20IKnownControllers%20%7B%0D%0A%20%20myDir%3A%20IMyDirController%0D%0A%7D%0D%0A%0D%0Aconst%20myOtherDir%3A%20IDirective%3C%7B%20myDir%3A%20string%20%7D%3E%20%3D%20%7B%0D%0A%20%20require%3A%20%7B%20myDir%3A%20'myDir'%20%7D%2C%0D%0A%20%20link%3A%20(c%20%2F*%20%7B%20myDir%3A%20IMyDirController%20%7D%20*%2F)%20%3D%3E%20undefined%2C%20%20%2F%2F%20Yay!%20%5Co%2F%0D%0A%7D%3B%0D%0A
https://github.com/thorn0
thorn0https://github.com/thorn0
on Jun 28, 2018https://github.com/angular/angular.js/issues/16617#issuecomment-400996485
@gkalpakhttps://github.com/gkalpak
https://github.com/gkalpak
gkalpakhttps://github.com/gkalpak
on Jun 28, 2018https://github.com/angular/angular.js/issues/16617#issuecomment-401054837
gkalpakhttps://github.com/gkalpak
1.7.x - won't fixhttps://github.com/angular/angular.js/milestone/145
on Sep 26, 2018https://github.com/angular/angular.js/issues/16617#event-1869253152
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular.js/issues/16617
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular.js/issues/16617
1.8.x - won't fixNo due datehttps://github.com/angular/angular.js/milestone/145
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.