Title: RangeError: Maximum call stack size exceeded · Issue #36608 · microsoft/TypeScript · GitHub
Open Graph Title: RangeError: Maximum call stack size exceeded · Issue #36608 · microsoft/TypeScript
X Title: RangeError: Maximum call stack size exceeded · Issue #36608 · microsoft/TypeScript
Description: TypeScript Version: 3.4.5 Search Terms: I was trying to convert ION to JSON using recursive function. My recursive function only have at most 10 layers depth. I don't know why it returns stack over flow error. If My ION file has less 100...
Open Graph Description: TypeScript Version: 3.4.5 Search Terms: I was trying to convert ION to JSON using recursive function. My recursive function only have at most 10 layers depth. I don't know why it returns stack over...
X Description: TypeScript Version: 3.4.5 Search Terms: I was trying to convert ION to JSON using recursive function. My recursive function only have at most 10 layers depth. I don't know why it returns stack ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/36608
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"RangeError: Maximum call stack size exceeded","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. Even if you think you've found a *bug*, please read the FAQ first, especially the Common \"Bugs\" That Aren't Bugs section!\r\n\r\nPlease help us by doing the following steps before logging an issue:\r\n * Search: https://github.com/Microsoft/TypeScript/search?type=Issues\r\n * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ\r\n\r\nPlease fill in the *entire* template below.\r\n-->\r\n\r\n\u003c!--\r\nPlease try to reproduce the issue with the latest published version. It may have already been fixed.\r\nFor npm: `typescript@next`\r\nThis is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly\r\n-->\r\n**TypeScript Version:** 3.4.5\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:**\r\nI was trying to convert ION to JSON using recursive function. My recursive function only have at most 10 layers depth. I don't know why it returns stack over flow error. If My ION file has less 1000 lines, this code works. However if the file contains more than 1200 lines, it return stack errors.\r\n\r\n**Code**\r\nconst getJsonFromIonReader = function(reader) {\r\n console.log('count: ', count++);\r\n const ionType = reader.type();\r\n\r\n if (ionType.name === 'struct') {\r\n const result = {};\r\n\r\n reader.stepIn();\r\n let current = reader.next();\r\n while (current != undefined) {\r\n result[reader.fieldName()] = getJsonFromIonReader(reader);\r\n current = reader.next();\r\n }\r\n reader.stepOut();\r\n return result;\r\n } else if (ionType.name === 'list') {\r\n const result = [];\r\n reader.stepIn();\r\n let current = reader.next();\r\n while (current != undefined) {\r\n result.push(getJsonFromIonReader(reader));\r\n current = reader.next();\r\n }\r\n reader.stepOut();\r\n return result;\r\n } else if (ionType.name === 'null') {\r\n return null;\r\n } else if (ionType.name === 'int') {\r\n return reader.numberValue();\r\n } else if (ionType.name === 'bool') {\r\n return reader.booleanValue();\r\n } else if (ionType.name === 'timestamp') {\r\n return reader.timestampValue().toString();\r\n } else if (ionType.name === 'decimal') {\r\n return reader.decimalValue().toString();\r\n } else if (ionType.isScalar === true) {\r\n return reader.stringValue();\r\n }\r\n throw new Error('encountered an ionType that is not handled: ' + ionType);\r\n};\r\n\r\n```ts\r\n// A *self-contained* demonstration of the problem follows...\r\n// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.\r\n```\r\n\r\n**Expected behavior:**\r\nIt should be able to convert ION to JSON for at least 4000 lines file\r\n\r\n**Actual behavior:**\r\nIt fails when the files size it more than 1000 lines\r\n\r\nRangeError: Maximum call stack size exceeded\r\n\r\n at checkExpressionWorker (node_modules/typescript/lib/typescript.js:52222:28)\r\n at checkExpression (node_modules/typescript/lib/typescript.js:52185:42)\r\n at checkBinaryLikeExpression (node_modules/typescript/lib/typescript.js:51650:28)\r\n at checkBinaryExpression (node_modules/typescript/lib/typescript.js:51638:20)\r\n at checkExpressionWorker (node_modules/typescript/lib/typescript.js:52281:28)\r\n at checkExpression (node_modules/typescript/lib/typescript.js:52185:42)\r\n at checkBinaryLikeExpression (node_modules/typescript/lib/typescript.js:51650:28)\r\n at checkBinaryExpression (node_modules/typescript/lib/typescript.js:51638:20)\r\n at checkExpressionWorker (node_modules/typescript/lib/typescript.js:52281:28)\r\n at checkExpression (node_modules/typescript/lib/typescript.js:52185:42)\r\n\r\n**Playground Link:** \u003c!-- A link to a TypeScript Playground \"Share\" link which demonstrates this behavior -->\r\n\r\n**Related Issues:** \u003c!-- Did you find other bugs that looked similar? -->\r\n","author":{"url":"https://github.com/longfeng-li","@type":"Person","name":"longfeng-li"},"datePublished":"2020-02-04T18:46:29Z","url":"https://github.com/microsoft/TypeScript/issues/36608"}
| 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:85c652df-f6ba-e03f-8a53-882e534a2084 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8144:2A7C1C:D9E0F0:1201F31:6B01CDD8 |
| html-safe-nonce | f39287c3dd7a46bae00ecb241cd3b0f306272aa94a0df7624c56e38f1f7cc38c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTQ0OjJBN0MxQzpEOUUwRjA6MTIwMUYzMTo2QjAxQ0REOCIsInZpc2l0b3JfaWQiOiI3NTcyMjgxMDU2OTUxMzg5NjU3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | aea7178c09fc3509adbea91a1059e73f584e616c66f75b1b145bd39d894f8eb7 |
| hovercard-subject-tag | issue:559908808 |
| 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/36608/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8f2a12611e13e2ea4ab721e7c8e417e6b519c47a2894d031aa9ff692c4315191/microsoft/TypeScript/issues/36608 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8f2a12611e13e2ea4ab721e7c8e417e6b519c47a2894d031aa9ff692c4315191/microsoft/TypeScript/issues/36608 |
| og:image:alt | TypeScript Version: 3.4.5 Search Terms: I was trying to convert ION to JSON using recursive function. My recursive function only have at most 10 layers depth. I don't know why it returns stack over... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | longfeng-li |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width