-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Cannot read properties of undefined (reading 'startsWith') #1053
Comments
+1 on me: (not using Sveltekit)
|
confirmed a clean project using |
please try downgrading esrap to ~1.2.0 via override in package.json |
Adding some context here. Having this <script lang="ts">
const test: string = "abc";
</script>
<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p> Gives the error that OP reported:
Diving into Side node: Actual error:
This is most likely caused by this recent PR sveltejs/esrap#13 Adding the following to https://github.com/Rich-Harris/esrap/blob/main/src/handlers.js#L560, reveals more: console.dir({node, state}, {depth: 10}); logged result: {
node: { type: 'EmptyStatement' },
state: {
commands: [
{ type: 'Chunk', content: '_page', loc: null },
'[',
{ type: 'Chunk', content: '$.FILENAME', loc: null },
']',
' = ',
{
type: 'Chunk',
content: '"src/routes/+page.svelte"',
loc: null
},
';',
{ type: 'Sequence', children: [ '\n' ] },
{ type: 'Newline' },
'import ',
{ type: 'Chunk', content: '* as $', loc: null },
' from ',
{ type: 'Chunk', content: '"svelte/internal/server"', loc: null },
';',
{ type: 'Sequence', children: [] },
{ type: 'Newline' },
'function ',
{ type: 'Chunk', content: '_page', loc: null },
'(',
{ type: 'Sequence', children: [] },
{ type: 'Chunk', content: '$$payload', loc: null },
',',
{ type: 'Sequence', children: [ ' ' ] },
{ type: 'Chunk', content: '$$props', loc: null },
{ type: 'Sequence', children: [] },
')',
' ',
'{',
{ type: 'Indent' },
{ type: 'Newline' },
{ type: 'Chunk', content: '$.push', loc: null },
'(',
{ type: 'Sequence', children: [] },
{ type: 'Chunk', content: '_page', loc: null },
{ type: 'Sequence', children: [] },
')',
';',
{ type: 'Sequence', children: [] },
{ type: 'Newline' },
'const ',
{ type: 'Sequence', children: [] },
{
type: 'Chunk',
content: 'test',
loc: SourceLocation {
start: Position { line: 2, column: 8 },
end: Position { line: 2, column: 20 }
}
}
],
comments: [],
multiline: false
}
} And that's as far as I got.. 😴 |
This is the correct temporary fix pending an update to the |
The bug isn't in |
Hi same problem here. |
@l3ackslash0 Read the entire thread. |
Sorry @webJose , Read the thread a bit too fast :) |
@l3ackslash0 no worries. It happens a lot to me. I was not nagging on you or anything. Just answering the question, which was a good thing as I was about to type a message to subscribe, as I'm impacted by this. |
Confirmed on clean install as well. Even the smallest level of typing throws it off. |
No problem 👍 ;) |
Seems to be affected since v5.0.0 |
Can someone provide the latest versions of svelte, sveltekit, vite, and such that do not reproduce these issues? |
@midirhee12, read the thread. You'll find a simple workaround if you cannot wait for the fix. |
@webJose Running Also, instead of telling people to "read the thread", it would be better to link the actual comment of the thread which noted the workaround. |
The workaround is stated above:
@midirhee12 Add the following to the {
"pnpm": {
"overrides": {
"esrap": "~1.2.0"
}
}
} About |
fixed in 5.14.3 |
This still seems to be happening, I've created a fresh project, added the 'svelte-awesome' package, adding it to
|
Please don't comment on closed issues, it's easy for updates to get missed |
opened a fresh issue on |
Describe the bug
Error on use Typescript type.
All explications in "reproduction" field.
Using:
Reproduction URL
http://localhost:5173/
Reproduction
How to reproduce the bug:
const test: string = "abc";
How to be sure that the bug comes from there:
4. Remove the type:
const test = "abc";
5. The bug disappears
Logs
No response
System Info
The text was updated successfully, but these errors were encountered: