Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transform Error when trailing space in Custom Component: Property value expected type of boolean but got undefined #2308

Open
2 tasks done
DanqingLuan opened this issue Jun 21, 2024 · 2 comments
Labels
bug Something isn't working compilation

Comments

@DanqingLuan
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

export default function SVGTEST() { let isUpperCase = false; const a = "ok"; return (<text>{isUpperCase ? a : a.toLocaleUpperCase()} </text>) }

An error occurs when there is a space between the closing curly brace } and the closing tag </text> at the end of the code, as in:
} </text>

However, the error disappears if the space is removed, as in:

}</text>

22:36:11 [vite] Internal server error: C:\Users\admin\Desktop\solid-project\src\components\typing\SVGTEST.tsx: Property value expected type of boolean but got undefined
Plugin: solid
File: C:/Users/admin/Desktop/solid-project/src/components/typing/SVGTEST.tsx
at Object.validate (C:\Users\admin\Desktop\solid-project\node_modules@babel\types\lib\definitions\utils.js:127:13)
at validateField (C:\Users\admin\Desktop\solid-project\node_modules@babel\types\lib\validators\validate.js:21:9)
at validate (C:\Users\admin\Desktop\solid-project\node_modules@babel\types\lib\validators\validate.js:15:3)
at validateNode (C:\Users\admin\Desktop\solid-project\node_modules@babel\types\lib\builders\validateNode.js:12:27)
at Object.booleanLiteral (C:\Users\admin\Desktop\solid-project\node_modules@babel\types\lib\builders\generated\index.js:450:36)
at C:\Users\admin\Desktop\solid-project\node_modules\babel-plugin-jsx-dom-expressions\index.js:1875:31
at Array.map ()
at appendTemplates$1 (C:\Users\admin\Desktop\solid-project\node_modules\babel-plugin-jsx-dom-expressions\index.js:1863:33)
at PluginPass.postprocess (C:\Users\admin\Desktop\solid-project\node_modules\babel-plugin-jsx-dom-expressions\index.js:3653:32)
at newFn (C:\Users\admin\Desktop\solid-project\node_modules@babel\traverse\lib\visitors.js:160:14)
at NodePath._call (C:\Users\admin\Desktop\solid-project\node_modules@babel\traverse\lib\path\context.js:46:20)
at NodePath.call (C:\Users\admin\Desktop\solid-project\node_modules@babel\traverse\lib\path\context.js:36:17)
at NodePath.visit (C:\Users\admin\Desktop\solid-project\node_modules@babel\traverse\lib\path\context.js:90:8)
at TraversalContext.visitQueue (C:\Users\admin\Desktop\solid-project\node_modules@babel\traverse\lib\context.js:89:16)
at TraversalContext.visitSingle (C:\Users\admin\Desktop\solid-project\node_modules@babel\traverse\lib\context.js:65:19)
at TraversalContext.visit (C:\Users\admin\Desktop\solid-project\node_modules@babel\traverse\lib\context.js:112:19)
at traverseNode (C:\Users\admin\Desktop\solid-project\node_modules@babel\traverse\lib\traverse-node.js:22:17)
at traverse (C:\Users\admin\Desktop\solid-project\node_modules@babel\traverse\lib\index.js:52:34)
at transformFile (C:\Users\admin\Desktop\solid-project\node_modules@babel\core\lib\transformation\index.js:82:31)
at transformFile.next ()
at run (C:\Users\admin\Desktop\solid-project\node_modules@babel\core\lib\transformation\index.js:24:12)
at run.next ()
at transform (C:\Users\admin\Desktop\solid-project\node_modules@babel\core\lib\transform.js:22:33)
at transform.next ()
at step (C:\Users\admin\Desktop\solid-project\node_modules\gensync\index.js:261:32)
at C:\Users\admin\Desktop\solid-project\node_modules\gensync\index.js:273:13
at async.call.result.err.err (C:\Users\admin\Desktop\solid-project\node_modules\gensync\index.js:223:11)
at C:\Users\admin\Desktop\solid-project\node_modules\gensync\index.js:189:28
at C:\Users\admin\Desktop\solid-project\node_modules@babel\core\lib\gensync-utils\async.js:67:7
at C:\Users\admin\Desktop\solid-project\node_modules\gensync\index.js:113:33
at step (C:\Users\admin\Desktop\solid-project\node_modules\gensync\index.js:287:14)
at C:\Users\admin\Desktop\solid-project\node_modules\gensync\index.js:273:13
at async.call.result.err.err (C:\Users\admin\Desktop\solid-project\node_modules\gensync\index.js:223:11) (x2)

Expected behavior 🤔

No response

Steps to reproduce 🕹

Steps:

1.Create a new SolidStart project.
2.Create a new file named svgtest.tsx.
3.Paste the following code into the svgtest.tsx file:
export default function SVGTEST() { let isUpperCase = false; const a = "ok"; return (<text>{isUpperCase ? a : a.toLocaleUpperCase()} </text>) }
4.Insert into the index.tsx file.
5.Run index.tsx and an error occurs.
6.Change the code in svgtest.tsx to the following:
7.export default function SVGTEST() { let isUpperCase = false; const a = "ok"; return (<text>{isUpperCase ? a : a.toLocaleUpperCase()}</text>) }
The error disappears.

Context 🔦

No response

Your environment 🌎

windows 10 x64

bun 1.1.15
@DanqingLuan DanqingLuan added the bug Something isn't working label Jun 21, 2024
@DanqingLuan
Copy link
Author

DanqingLuan commented Jun 21, 2024

Steps:

1.Create a new SolidStart project.
2.Create a new file named svgtest.tsx.
3.Paste the following code into the svgtest.tsx file:

export default function SVGTEST() { let isUpperCase = false; const a = "ok"; return (<text>{isUpperCase ? a : a.toLocaleUpperCase()} </text>) }

4.Insert into the index.tsx file.

<SVGTEST></SVGTEST>

5.Run index.tsx and an error occurs.
6.Change the code in svgtest.tsx to the following:
7.The error disappears.

export default function SVGTEST() { let isUpperCase = false; const a = "ok"; return (<text>{isUpperCase ? a : a.toLocaleUpperCase()}</text>) }

@ryansolid
Copy link
Member

This looks like a compiler error and has nothing to do with SolidStart. I can reproduce it in the playground: https://playground.solidjs.com/anonymous/6e22d979-a8f8-4548-b74f-1ebc68d67a4b

I will move this where it belongs

@ryansolid ryansolid changed the title [Bug?]: [vite] Pre-transform error: xxx.tsx: Property value expected type of boolean but got undefined Transform Error when trailing space in Custom Component: Property value expected type of boolean but got undefined Sep 25, 2024
@ryansolid ryansolid transferred this issue from solidjs/solid-start Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compilation
Projects
None yet
Development

No branches or pull requests

2 participants