fix: allow for whitespace in snippets declaration#2366
Conversation
|
Umh...i don't know if i've fucked up the expected file here...it seems strange that is a new one. |
|
This is because the generated snapshot is always written to the v5 file but the expected file can be both. You can move the content to the expetectv2.js file and remove the v5 file. We can tweak the snapshot generation in a separate PR. But It's probably a small change so if you're interested in tweaking it, I wouldn't mind if it's done in this PR. |
How it should be tweaked specifically? |
|
TBH I'm not sure there's a good way to tweak it, because the test generation can't know if the code deviates sufficiently enough from |
Fixed it |
This should close sveltejs/svelte#11478
The problem was that the generic generation was relying on the start position of
typeAnnotation+ 1. But if there are whytespaces this is not correct and the generate type is wrongSnippet<[: string]>. However inside the firsttypeAnnotationthere's always a secondtypeAnnotationfield which only includes the actual types (at least from what i was able to see, i wasn't able to find a type that doesn't generate at least two level deepstypeAnnotation).This seems to work fine but give it a good look since it's the first time i'm working in this repo.