Closed bartlomein closed 9 months ago
Same problem here
If I import a custom tsconfig.json
and turn allowJs
to false
it will stop crashing. However then I get Operator '<' cannot be applied to types
and such errors even though inside the tsconfig.json
I have "jsx": "react-native",
set
Thanks for the hint @bartlomein, I was able to reproduce it and setting allowJs
to false
fixes the issue. I think I have a solution for root cause of this:
Can you try adding visionos
folder to "exclude"
in tsconfig.json?
"exclude": [
//...
"visionos"
]
I guess that this comes from visionos building Hermes from the source and clones its repo to the visionos/Pods
folder (which also contains some JS) and TS Server is trying to go through those files which leads to crash
@okwasniewski Yup! that seems to have done it. Thanks so much!
I'm pinning this issue until we will have an upstream solution for the bug.
For now, for anyone that's struggling with this, you can replace the contents of your tsconfig.json
with this:
{
"extends": "@react-native/typescript-config/tsconfig.json",
"exclude": [
"visionos", // <- Add this
"node_modules",
"babel.config.js",
"metro.config.js",
"jest.config.js"
]
}
A new version of @react-native/typescript-config
(nightly) has been released. We can use it in the visionOS template from 0.74 but you can use it today in your app by changing the version. The template has this temporary workaround for now (which will be removed later).
Thanks @bartlomein for contributing to the fix 🙌
Description
Once I install dependencies and open the repo in VS code, TS server crashes. This happens on workspace TS version and repo TS version
Steps to reproduce
React Native Version
0.73.3
Affected Platforms
Other (please specify)
Output of
npx react-native info
Stacktrace or Logs
RangeError: Maximum call stack size exceeded at Object.scan (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:12637:16) at nextTokenWithoutCheck (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31454:36) at nextToken (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31464:12) at isParenthesizedArrowFunctionExpressionWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33842:20) at speculationHelper (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:13458:20) at Object.lookAhead (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:13491:12) at speculationHelper (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31501:68) at lookAhead (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31513:12) at isParenthesizedArrowFunctionExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33824:14) at tryParseParenthesizedArrowFunctionExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33811:22) at parseAssignmentExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33717:29) at parseExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33688:16) at doOutsideOfContext (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31354:12) at allowInAnd (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31375:12) at parseParenthesizedExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34841:24) at parsePrimaryExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34803:16) at parseMemberExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34242:24) at parseLeftHandSideExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34236:82) at parseUpdateExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34211:24) at parseUnaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34130:32) at parseBinaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34052:25) at parseAssignmentExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33723:18) at parseExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33688:16) at doOutsideOfContext (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31354:12) at allowInAnd (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31375:12) at parseParenthesizedExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34841:24) at parsePrimaryExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34803:16) at parseMemberExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34242:24) at parseLeftHandSideExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34236:82) at parseUpdateExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34211:24) at parseUnaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34130:32) at parseBinaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34052:25) at parseAssignmentExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33723:18) at parseExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33688:16) at doOutsideOfContext (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31354:12) at allowInAnd (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31375:12) at parseParenthesizedExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34841:24) at parsePrimaryExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34803:16) at parseMemberExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34242:24) at parseLeftHandSideExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34236:82) at parseUpdateExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34211:24) at parseUnaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34130:32) at parseBinaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34052:25) at parseAssignmentExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33723:18) at parseExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33688:16) at doOutsideOfContext (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31354:12) at allowInAnd (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31375:12) at parseParenthesizedExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34841:24) at parsePrimaryExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34803:16) at parseMemberExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34242:24) at parseLeftHandSideExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34236:82) at parseUpdateExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34211:24) at parseUnaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34130:32) at parseBinaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34052:25) at parseAssignmentExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33723:18) at parseExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33688:16) at doOutsideOfContext (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31354:12) at allowInAnd (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31375:12) at parseParenthesizedExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34841:24) at parsePrimaryExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34803:16) at parseMemberExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34242:24) at parseLeftHandSideExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34236:82) at parseUpdateExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34211:24) at parseUnaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34130:32) at parseBinaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34052:25) at parseAssignmentExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33723:18) at parseExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33688:16) at doOutsideOfContext (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31354:12) at allowInAnd (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31375:12) at parseParenthesizedExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34841:24) at parsePrimaryExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34803:16) at parseMemberExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34242:24) at parseLeftHandSideExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34236:82) at parseUpdateExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34211:24) at parseUnaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34130:32) at parseBinaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34052:25) at parseAssignmentExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33723:18) at parseExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33688:16) at doOutsideOfContext (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31354:12) at allowInAnd (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31375:12) at parseParenthesizedExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34841:24) at parsePrimaryExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34803:16) at parseMemberExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34242:24) at parseLeftHandSideExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34236:82) at parseUpdateExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34211:24) at parseUnaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34130:32) at parseBinaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34052:25) at parseAssignmentExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33723:18) at parseExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33688:16) at doOutsideOfContext (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31354:12) at allowInAnd (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31375:12) at parseParenthesizedExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34841:24) at parsePrimaryExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34803:16) at parseMemberExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34242:24) at parseLeftHandSideExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34236:82) at parseUpdateExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34211:24) at parseUnaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34130:32) at parseBinaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34052:25) at parseAssignmentExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33723:18) at parseExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33688:16)
Reproducer
https://github.com/callstack/react-native-visionos
Screenshots and Videos