Title: Add type predicate to Boolean (BooleanConstructor) · Issue #32834 · microsoft/TypeScript · GitHub
Open Graph Title: Add type predicate to Boolean (BooleanConstructor) · Issue #32834 · microsoft/TypeScript
X Title: Add type predicate to Boolean (BooleanConstructor) · Issue #32834 · microsoft/TypeScript
Description: Suggestion Add an overload to Boolean defintion interface BooleanConstructor { new(value?: any): Boolean; -
Open Graph Description: Suggestion Add an overload to Boolean defintion interface BooleanConstructor { new(value?: any): Boolean; - X Description: Suggestion Add an overload to Boolean defintion interface BooleanConstructor { new(value?: any): Boolean; - <T>(value?: T): boolean; + <T>(value?: T): value is Exclude<T, false | nul...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/32834
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add type predicate to Boolean (BooleanConstructor)","articleBody":"\u003c!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨\r\n\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Please read the FAQ first, especially the \"Common Feature Requests\" section.\r\n\r\n-->\r\n\r\n## Suggestion\r\n\r\nAdd an overload to `Boolean` defintion\r\n\r\n```diff\r\n interface BooleanConstructor {\r\n new(value?: any): Boolean;\r\n- \u003cT>(value?: T): boolean;\r\n+ \u003cT>(value?: T): value is Exclude\u003cT, false | null | undefined | 0 | ''>\r\n readonly prototype: Boolean;\r\n }\r\n```\r\n\r\n[playground](https://www.typescriptlang.org/play/#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXwCMccIAeADQD54AKADwH4Auec+AH3lWQggEoWdeFgDO8AKJ1IyUBQA0SKBBEJO3Xh3hpQiLKhDBNABk0ByU5QBQl0JFgIweERiTEWARgBMAZk1ESIFD4nCac2iC6+sDWWIi0-hA0iMR8fPAA3pbw2a44lgC+lkA)\r\n\r\n## Use Cases\r\n\r\n\u003c!--\r\nWhat do you want to use this for?\r\nWhat shortcomings exist with current approaches?\r\n-->\r\n\r\n### `Array.filter`\r\n\r\n```typescript\r\ndeclare const actions: Array\u003c(() => void) | null | undefined>\r\nactions.filter(Boolean).forEach(act => act())\r\n```\r\n\r\n## Checklist\r\n\r\nMy suggestion meets these guidelines:\r\n\r\n* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code\r\n* [x] This wouldn't change the runtime behavior of existing JavaScript code\r\n* [x] This could be implemented without emitting different JS based on the types of the expressions\r\n* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)\r\n* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).\r\n\r\n","author":{"url":"https://github.com/KSXGitHub","@type":"Person","name":"KSXGitHub"},"datePublished":"2019-08-13T02:41:38Z","url":"https://github.com/microsoft/TypeScript/issues/32834"}
react-profiling 0 react-import-map react,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-controller voltron_issues_fragments route-action issue_layout fetch-nonce v2:c8a094dd-47db-4798-3abd-33a63c33c724 current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id BF78:A20F9:BD62C8:FD236C:6B00F228 html-safe-nonce d963adad6e133fda25c1cf08588c8d7bd43814d723aa2e478330a44bb5f05483 visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRjc4OkEyMEY5OkJENjJDODpGRDIzNkM6NkIwMEYyMjgiLCJ2aXNpdG9yX2lkIjoiMzg3ODM3MDA5MDE1MTg5OTY4OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 visitor-hmac 073165419b9e2625bcb5268ae3d7122f7389f9e58b00c6f37dcec9c7e90e4b23 hovercard-subject-tag issue:479932497 github-keyboard-shortcuts repository,issues,copilot google-site-verification Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I octolytics-url https://collector.github.com/github/collect analytics-location / fb:app_id 1401488693436528 apple-itunes-app app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/32834/issue_layout twitter:image https://opengraph.githubassets.com/d0af7756bd602f51fc0604bec557a3c89529d45ec964dda0419343bbc89dc1e0/microsoft/TypeScript/issues/32834 twitter:card summary_large_image og:image https://opengraph.githubassets.com/d0af7756bd602f51fc0604bec557a3c89529d45ec964dda0419343bbc89dc1e0/microsoft/TypeScript/issues/32834 og:image:alt Suggestion Add an overload to Boolean defintion interface BooleanConstructor { new(value?: any): Boolean; - og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username KSXGitHub hostname github.com expected-hostname github.com None 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc turbo-cache-control no-preview go-import github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git octolytics-dimension-user_id 6154722 octolytics-dimension-user_login microsoft octolytics-dimension-repository_id 20929025 octolytics-dimension-repository_nwo microsoft/TypeScript octolytics-dimension-repository_public true octolytics-dimension-repository_is_fork false octolytics-dimension-repository_network_root_id 20929025 octolytics-dimension-repository_network_root_nwo microsoft/TypeScript turbo-body-classes logged-out env-production page-responsive disable-turbo false browser-stats-url https://api.github.com/_private/browser/stats browser-errors-url https://api.github.com/_private/browser/errors release 9983dd5da06943f833c971dd5b6bc988e2858be5 ui-target full theme-color #1e2327 color-scheme light dark react-app-name issues
URLs of crawlers that visited me.