René's URL Explorer Experiment


Title: Add a --strictNaNChecks option, and a NaN / integer / float type to avoid runtime NaN errors · Issue #28682 · microsoft/TypeScript · GitHub

Open Graph Title: Add a --strictNaNChecks option, and a NaN / integer / float type to avoid runtime NaN errors · Issue #28682 · microsoft/TypeScript

X Title: Add a --strictNaNChecks option, and a NaN / integer / float type to avoid runtime NaN errors · Issue #28682 · microsoft/TypeScript

Description: I have read the FAQ and looked for duplicate issues. Search Terms NaN NaN type Integer type Related Issues #21279: strictNullChecks safeguards against null and undefined, but not NaN #15135: NaN, Infinity and -Infinity not accepted in nu...

Open Graph Description: I have read the FAQ and looked for duplicate issues. Search Terms NaN NaN type Integer type Related Issues #21279: strictNullChecks safeguards against null and undefined, but not NaN #15135: NaN, I...

X Description: I have read the FAQ and looked for duplicate issues. Search Terms NaN NaN type Integer type Related Issues #21279: strictNullChecks safeguards against null and undefined, but not NaN #15135: NaN, I...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add a --strictNaNChecks option, and a NaN / integer / float type to avoid runtime NaN errors","articleBody":"*I have read the FAQ and looked for duplicate issues.*\r\n\r\n## Search Terms\r\n\r\n* NaN\r\n* NaN type\r\n* Integer type\r\n\r\n## Related Issues\r\n\r\n* [#21279: strictNullChecks safeguards against null and undefined, but not NaN ](https://github.com/Microsoft/TypeScript/issues/21279)\r\n* [#15135: NaN, Infinity and -Infinity not accepted in number literal types](https://github.com/Microsoft/TypeScript/issues/15135)\r\n  * [#15351: Infinity/NaN literal type (dup)](https://github.com/Microsoft/TypeScript/issues/15351)\r\n* [#195: Suggestion: int type](https://github.com/Microsoft/TypeScript/issues/195)\r\n* [#4639: Proposal: int types](https://github.com/Microsoft/TypeScript/issues/4639)\r\n  * BigInt is scheduled for TS 3.0 - [#15096 - Support for TC39 \"BigInt: Arbitrary precision integers in JavaScript\" proposal](https://github.com/Microsoft/TypeScript/issues/15096)\r\n\r\n## Suggestion\r\n\r\n`NaN` has been a big source of errors in my code. I was under the impression that TypeScript (and Flow) could help to prevent these errors, but this is not really true.\r\n\r\nTypeScript can prevent *some* `NaN` errors, because you cannot add a number to an object, for example. But there are many math operations that can return `NaN`. These `NaN` values often propagate through the code silently and crash in some random place that was expecting an integer or a float. It can be extremely difficult to backtrack through the code and try to figure out where the `NaN` came from.\r\n\r\nI would like TypeScript to provide a better way of preventing runtime `NaN` errors, by ensuring that an unhandled `NaN` value cannot propagate throughout the code. This would be a compile-time check in TypeScript. Other solutions might be a run-time check added with a Babel plugin, or a way for JS engines to throw an error instead of returning `NaN` (but these are outside the scope of this issue.)\r\n\r\n## Use Cases / Examples\r\n\r\n```js\r\nconst testFunction = (a: number, b: number) => {\r\n  if (a > b) {\r\n    return;\r\n  } else if (a \u003c b) {\r\n    return;\r\n  } else if (a === b) {\r\n    return;\r\n  } else {\r\n    throw new Error(\"Unreachable code\");\r\n  }\r\n}\r\n\r\ntestFunction(1, 2);\r\n\r\ntestFunction(1, 0 / 0);\r\n\r\ntestFunction(1, Math.log(-1));\r\n\r\ntestFunction(1, Math.sqrt(-2));\r\n\r\ntestFunction(1, Math.pow(99999999, 99999999));\r\n\r\ntestFunction(1, parseFloat('string'));\r\n```\r\n\r\nA programmer might assume that the `Unreachable code` error could never be thrown, because the conditions appear to be exhaustive, and the types of `a` and `b` are `number`. It is very easy to forget that `NaN` breaks all the rules of comparison and equality checks.\r\n\r\nIt would be really helpful if TypeScript could warn about the possibility of `NaN` with a more fine-grained type system, so that the programmer was forced to handle these cases.\r\n\r\n### Possible Solutions \r\n\r\nTypeScript could add a `--strictNaNChecks` option. To implement this, I think TS might need to add some more fine-grained number types that can be used to exclude `NaN`. The return types of built-in JavaScript functions and operations would be updated to show which functions can return `NaN`, and which ones can never return `NaN`. A call to `!isNaN(a)` would narrow down the type and remove the possibility of `NaN`.\r\n\r\nHere are some possible types that would make this possible:\r\n\r\n```ts\r\ntype integer\r\ntype float\r\ntype NaN\r\ntype Infinity\r\n\r\ntype number = integer | float | NaN | Infinity   // Backwards compatible\r\ntype realNumber = integer | float   // NaN and Infinity are not valid values\r\n```\r\n(I don't know if `realNumber` is a good name, but hopefully it gets the point across.)\r\n\r\nHere are some examples of what this new type system might look like:\r\n\r\n```ts\r\nconst testFunction = (a: integer, b: integer) => {\r\n  if (a > b || a \u003c b || a === b) {\r\n    return;\r\n  } else {\r\n    throw new Error(\"Unreachable code\");\r\n  }\r\n}\r\n\r\n// Ok\r\ntestFunction(1, 2);\r\n\r\n// Type error. TypeScript knows that a division might produce a NaN or a float\r\ntestFunction(1, 0 / 0);\r\n\r\nconst a: integer = 1;\r\nconst b: integer = 0;\r\n\r\nconst c = a + b;  // inferred type is `integer`. Adding two integers cannot produce NaN or Infinity.\r\ntestFunction(1, c); // Ok\r\n\r\nconst d = a / b;   // inferred type is `number`, which includes NaN and Infinity.\r\ntestFunction(1, d); // Type error (number is not integer)\r\n\r\nconst e = -2;   // integer\r\nconst f = Math.sqrt(e);    // inferred type is: integer | float | NaN    (sqrt of an integer cannot return Infinity)\r\n\r\nconst g: number = 2; \r\nconst h = Math.sqrt(g);    // inferred type is number (sqrt of Infinity is Infinity)\r\n\r\ntestFunction(1, h);  // Type error. `number` is not compatible with `integer`.\r\n\r\nif (!isNaN(h)) {\r\n  // The type of h has been narrowed down to integer | float | Infinity\r\n  testFunction(1, h);  // Still a type error. integer | float | Infinity is not compatible with integer.\r\n}\r\n\r\nif (Number.isInteger(h)) {\r\n  // The type of h has been narrowed down to integer\r\n  testFunction(1, h);  // Ok\r\n}\r\n```\r\n\r\nWhen the `--strictNaNChecks` option is disabled (default), then the `integer` and `float` types would also include `NaN` and `Infinity`:\r\n\r\n```ts\r\ntype integer      // Integers plus NaN and Infinity\r\ntype float        // Floats plus NaN and Infinity\r\n\r\ntype number = integer | float    // Backwards compatible\r\ntype realNumber = number         // Just an alias, for forwards-compatibility.\r\n```\r\n\r\nI would personally be in favor of making this the default behavior, because `NaN` errors have caused me a lot of pain in the past. They even made me lose trust in the type system, because I didn't realize that it was still possible to run into them. I would really love to prevent errors like this at compile-time:\r\n\r\n\u003cimg width=\"446\" alt=\"screen shot 2018-11-27 at 4 35 34 pm\" src=\"https://user-images.githubusercontent.com/139536/49078834-aba8e900-f271-11e8-8bbe-15ae4ea7f930.png\">\r\n\r\nThis error is from a fully-typed Flow app, although I'm switching to TypeScript for any future projects. It's one of the very few crashes that I've seen in my app, but I just gave up because I have no idea where it was coming from. I actually thought it was a bug in Flow, but now I understand that type checking didn't protect me against `NaN` errors. It would be really awesome if it did! \r\n\r\n(Sorry for the Flow example, but this is a real-world example where a `NaN` type check would have saved me a huge amount of time.)\r\n\r\n## Number Literal Types\r\n\r\nIt would be annoying if you had to call `isNaN()` after every division. When the programmer calls `a / 2`, there is no need to warn about `NaN` (unless `a` is a `number` type that could potentially be `NaN`.) `NaN` is only possible for `0 / 0`. So if either the dividend or the divisor are non-zero numbers, then the `NaN` type can be excluded in the return type. And actually zero can be excluded as well, if both dividend and divisor are non-zero.\r\n\r\nMaybe this can be done with the `Exclude` [conditional type](https://www.typescriptlang.org/docs/handbook/advanced-types.html#conditional-types)? Something like:\r\n\r\n```ts\r\ntype nonZeroNumber = Exclude\u003cnumber, 0>\r\ntype nonZeroRealNumber = Exclude\u003crealNumber, 0>\r\ntype nonZeroInteger = Exclude\u003cinteger, 0>\r\ntype nonZeroFloat = Exclude\u003cfloat, 0>\r\n```\r\n\r\nIf the dividend and divisor type both match `nonZeroInteger`, then the return type would be `nonZeroFloat`. So you could test any numeric literal types against these non-zero types. e.g.:\r\n\r\n```\r\nconst a = 2;     // Type is numeric literal \"2\"\r\n\r\n// \"a\" matches the \"nonZeroInteger\" type, so the return type is \"nonZeroFloat\" \r\n// (this excludes Infinity as well.)\r\n// (Technically it could be \"nonZeroInteger\", or even \"2\" if TypeScript did \r\n// constant propagation. But that's way outside the scope of this issue.)\r\nconst b = 4 / a;\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\r\n\r\n","author":{"url":"https://github.com/ndbroadbent","@type":"Person","name":"ndbroadbent"},"datePublished":"2018-11-27T11:13:26Z","url":"https://github.com/microsoft/TypeScript/issues/28682"}

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:aaceccba-2843-428d-1f56-342ad44f4913
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9254:76282:10A3AA1:171941B:6AFBFFA5
html-safe-nonce2584f77117f7ca862eef84e8a665a0201fe79bf7e6b2feaac0906333fda6193f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MjU0Ojc2MjgyOjEwQTNBQTE6MTcxOTQxQjo2QUZCRkZBNSIsInZpc2l0b3JfaWQiOiI1Mzg3NDgyNTg3MDU0NDczMTI2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac5a76d1dcf5754f2f1d8a8f8d2d301f19362f50d747a60192e0a636fb901bd53f
hovercard-subject-tagissue:384743645
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/28682/issue_layout
twitter:imagehttps://opengraph.githubassets.com/56b087c74d55f5fb86be56f9b6a55d0348cd5669ff123f04d1bda5ee85af6744/microsoft/TypeScript/issues/28682
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/56b087c74d55f5fb86be56f9b6a55d0348cd5669ff123f04d1bda5ee85af6744/microsoft/TypeScript/issues/28682
og:image:altI have read the FAQ and looked for duplicate issues. Search Terms NaN NaN type Integer type Related Issues #21279: strictNullChecks safeguards against null and undefined, but not NaN #15135: NaN, I...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamendbroadbent
hostnamegithub.com
expected-hostnamegithub.com
Nonefa74413a1d84dac536fcca0740780bcbd3207bafec0e51873b73ff8e8cca032f
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
releaseb3b5633a74535d9c23385512d534c66c8fde1907
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/28682#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F28682
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%2F28682
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/28682
Reloadhttps://github.com/microsoft/TypeScript/issues/28682
Reloadhttps://github.com/microsoft/TypeScript/issues/28682
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests336 (336)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/pulse
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/28682
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/28682
Add a --strictNaNChecks option, and a NaN / integer / float type to avoid runtime NaN errorshttps://github.com/microsoft/TypeScript/issues/28682#top
Domain: Literal TypesUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20Literal%20Types%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
https://github.com/ndbroadbent
Nathan Broadbent (ndbroadbent)https://github.com/ndbroadbent
on Nov 27, 2018https://github.com/microsoft/TypeScript/issues/28682#issue-384743645
#21279: strictNullChecks safeguards against null and undefined, but not NaN https://github.com/Microsoft/TypeScript/issues/21279
#15135: NaN, Infinity and -Infinity not accepted in number literal typeshttps://github.com/Microsoft/TypeScript/issues/15135
#15351: Infinity/NaN literal type (dup)https://github.com/Microsoft/TypeScript/issues/15351
#195: Suggestion: int typehttps://github.com/Microsoft/TypeScript/issues/195
#4639: Proposal: int typeshttps://github.com/Microsoft/TypeScript/issues/4639
#15096 - Support for TC39 "BigInt: Arbitrary precision integers in JavaScript" proposalhttps://github.com/Microsoft/TypeScript/issues/15096
https://user-images.githubusercontent.com/139536/49078834-aba8e900-f271-11e8-8bbe-15ae4ea7f930.png
conditional typehttps://www.typescriptlang.org/docs/handbook/advanced-types.html#conditional-types
TypeScript's Design Goalshttps://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
Nexthttps://github.com/microsoft/TypeScript/issues/28682?timeline_page=1
Nathan Broadbent (ndbroadbent)https://github.com/ndbroadbent
on Nov 27, 2018https://github.com/microsoft/TypeScript/issues/28682#event-1989269916
Wesley Wigham (weswigham)https://github.com/weswigham
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
Domain: Literal TypesUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20Literal%20Types%22
on Nov 27, 2018https://github.com/microsoft/TypeScript/issues/28682#event-1990232148
https://github.com/devlato
Denis Tokarev (devlato)https://github.com/devlato
on Nov 29, 2018https://github.com/microsoft/TypeScript/issues/28682#issuecomment-443030716
#195https://github.com/Microsoft/TypeScript/issues/195
#4639https://github.com/Microsoft/TypeScript/issues/4639
https://github.com/reli-msft
Renzhi Li (reli-msft)https://github.com/reli-msft
on Jun 28, 2019https://github.com/microsoft/TypeScript/issues/28682#issuecomment-506899326
https://github.com/AnyhowStep
AnyhowStephttps://github.com/AnyhowStep
on Sep 30, 2019https://github.com/microsoft/TypeScript/issues/28682#issuecomment-536657476
https://github.com/AnyhowStep/tsql/blob/adbfcf666ef71be4b6c03567a8d14a88ab699d7c/doc/00-getting-started/01-data-types.md#signed-integerhttps://github.com/AnyhowStep/tsql/blob/adbfcf666ef71be4b6c03567a8d14a88ab699d7c/doc/00-getting-started/01-data-types.md#signed-integer
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger#Polyfillhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger#Polyfill
https://github.com/MaxGraey
Max Graey (MaxGraey)https://github.com/MaxGraey
on Nov 11, 2019https://github.com/microsoft/TypeScript/issues/28682#issuecomment-552352389
https://github.com/benwiley4000
Ben Wiley (benwiley4000)https://github.com/benwiley4000
on May 5, 2020https://github.com/microsoft/TypeScript/issues/28682#issuecomment-624061103
https://github.com/captain-yossarian
yossarian (captain-yossarian)https://github.com/captain-yossarian
on May 24, 2020https://github.com/microsoft/TypeScript/issues/28682#issuecomment-633202486
https://github.com/JasonHK
Jason Kwok (JasonHK)https://github.com/JasonHK
on May 25, 2020https://github.com/microsoft/TypeScript/issues/28682#issuecomment-633447707
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Oct 12, 2020https://github.com/microsoft/TypeScript/issues/28682#issuecomment-707142417
https://github.com/calimeroteknik
calimeroteknikhttps://github.com/calimeroteknik
on Dec 4, 2020https://github.com/microsoft/TypeScript/issues/28682#issuecomment-738799877
https://github.com/ExE-Boss
ExE Boss (ExE-Boss)https://github.com/ExE-Boss
on Feb 21, 2021https://github.com/microsoft/TypeScript/issues/28682#issuecomment-782876469
#42905https://github.com/microsoft/TypeScript/issues/42905
https://github.com/engine262/engine262/blob/ab4baf1b1faeae35da022aea6c60a6a824822167/src/abstract-ops/type-conversion.mjs#L404-L415https://github.com/engine262/engine262/blob/ab4baf1b1faeae35da022aea6c60a6a824822167/src/abstract-ops/type-conversion.mjs#L404-L415
https://github.com/engine262/engine262/blob/ab4baf1b1faeae35da022aea6c60a6a824822167/src/abstract-ops/type-conversion.mjs#L386-L394https://github.com/engine262/engine262/blob/ab4baf1b1faeae35da022aea6c60a6a824822167/src/abstract-ops/type-conversion.mjs#L386-L394
https://github.com/nicolas377
Nick Rodriguez (nicolas377)https://github.com/nicolas377
on Jul 29, 2022https://github.com/microsoft/TypeScript/issues/28682#issuecomment-1199945294
playgroundhttps://www.typescriptlang.org/play#code/PTAEBcAsFNQBwPYEsB25QIGYUkgzhAJ5yz44CG6KCUqA5qGeQMbgCu5ANp4aOQEadY4BKH6xyePEjopoAEwiik4AFAgxbdCtDNyKMbDZ4FjA5JMAncEgQoCWPqBRsAtuMtESq8MVgA5cn9QAF5nNw9QADJQAG9QS2hyeTseUDYUCxlMwWgALnSUJABHNlg8QncETlAAXwBuVVVUcGhLTBYAiLaAYTs8cEs2VgRPWNVQRjxA-wAKF1cChY8ASiW3KdAZxtqmlraO5lgAWUpIOInQTgQ6WYAPdfc2tfCnzwAfLaCdpuZ+9GudHIlhUkFcoVApygADpAbMAMwABhWjQ0k1AAD0APx7bCzfzdSzQ-AzWaA4Gg1wrFYXSbkkFQVyNSYabGqWqgaCcEy0q43CmM5mgVk43ZAA
https://github.com/avin-kavish
Avin (avin-kavish)https://github.com/avin-kavish
on Aug 2, 2022https://github.com/microsoft/TypeScript/issues/28682#issuecomment-1202060244
https://github.com/muhamedkarajic
Muhamed Karajic (muhamedkarajic)https://github.com/muhamedkarajic
on Mar 29, 2023https://github.com/microsoft/TypeScript/issues/28682#issuecomment-1488416409
https://github.com/ca-d
cad (ca-d)https://github.com/ca-d
on Apr 5, 2023https://github.com/microsoft/TypeScript/issues/28682#issuecomment-1497933338
https://github.com/KarolS
Karol Stasiak (KarolS)https://github.com/KarolS
on May 25, 2023https://github.com/microsoft/TypeScript/issues/28682#issuecomment-1563530381
https://github.com/bbrk24
bbrk24https://github.com/bbrk24
on May 25, 2023https://github.com/microsoft/TypeScript/issues/28682#issuecomment-1563569692
https://github.com/muhamedkarajic
Muhamed Karajic (muhamedkarajic)https://github.com/muhamedkarajic
on Jul 6, 2023https://github.com/microsoft/TypeScript/issues/28682#issuecomment-1622722815
https://github.com/SheepTester
Sean Yen (SheepTester)https://github.com/SheepTester
on Jul 6, 2023https://github.com/microsoft/TypeScript/issues/28682#issuecomment-1623449256
https://github.com/rschristian
Ryan Christian (rschristian)https://github.com/rschristian
on Jan 26, 2024https://github.com/microsoft/TypeScript/issues/28682#issuecomment-1911929142
https://github.com/KarolS
Karol Stasiak (KarolS)https://github.com/KarolS
on Feb 3, 2024https://github.com/microsoft/TypeScript/issues/28682#issuecomment-1925488627
https://github.com/mharj
Marko Harjula (mharj)https://github.com/mharj
on Mar 15, 2024https://github.com/microsoft/TypeScript/issues/28682#issuecomment-1999271161
https://github.com/Akindin
Akindinhttps://github.com/Akindin
on Nov 8, 2024https://github.com/microsoft/TypeScript/issues/28682#issuecomment-2463729154
https://github.com/Akindin
Akindinhttps://github.com/Akindin
on Nov 8, 2024https://github.com/microsoft/TypeScript/issues/28682#issuecomment-2463731416
https://github.com/Rudxain
Ricardo Fernández Serrata (Rudxain)https://github.com/Rudxain
on Nov 19, 2024https://github.com/microsoft/TypeScript/issues/28682#issuecomment-2485657146
Refinement typeshttps://en.wikipedia.org/wiki/Refinement_type
https://arxiv.org/pdf/1604.02480.pdfhttps://arxiv.org/pdf/1604.02480.pdf
#14833https://github.com/microsoft/TypeScript/issues/14833
https://github.com/IanBellomy
Ian Bellomy (IanBellomy)https://github.com/IanBellomy
on Mar 9, 2026https://github.com/microsoft/TypeScript/issues/28682#issuecomment-4023538237
#1897https://github.com/microsoft/TypeScript/issues/1897
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/28682
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/28682
Domain: Literal TypesUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20Literal%20Types%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%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.