mirror of https://github.com/sveltejs/svelte
fix: add `typeParams` to `SnippetBlock` for legacy parser (#15921)
parent
623cfb0653
commit
0e22b54110
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: add `typeParams` to `SnippetBlock` for legacy parser
|
@ -0,0 +1,10 @@
|
||||
<script lang="ts">
|
||||
</script>
|
||||
|
||||
{#snippet generic<T extends string>(val: T)}
|
||||
{val}
|
||||
{/snippet}
|
||||
|
||||
{#snippet complex_generic<T extends { bracket: "<" } | "<" | Set<"<>">>(val: T)}
|
||||
{val}
|
||||
{/snippet}
|
@ -0,0 +1,244 @@
|
||||
{
|
||||
"html": {
|
||||
"type": "Fragment",
|
||||
"start": 30,
|
||||
"end": 192,
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 28,
|
||||
"end": 30,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "SnippetBlock",
|
||||
"start": 30,
|
||||
"end": 92,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 40,
|
||||
"end": 47,
|
||||
"name": "generic"
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start": 66,
|
||||
"end": 72,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 36
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 42
|
||||
}
|
||||
},
|
||||
"name": "val",
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start": 69,
|
||||
"end": 72,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 39
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 42
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeReference",
|
||||
"start": 71,
|
||||
"end": 72,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 41
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 42
|
||||
}
|
||||
},
|
||||
"typeName": {
|
||||
"type": "Identifier",
|
||||
"start": 71,
|
||||
"end": 72,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 41
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 42
|
||||
}
|
||||
},
|
||||
"name": "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 76,
|
||||
"end": 81,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 77,
|
||||
"end": 80,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 5
|
||||
}
|
||||
},
|
||||
"name": "val"
|
||||
}
|
||||
}
|
||||
],
|
||||
"typeParams": "T extends string"
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"start": 92,
|
||||
"end": 94,
|
||||
"raw": "\n\n",
|
||||
"data": "\n\n"
|
||||
},
|
||||
{
|
||||
"type": "SnippetBlock",
|
||||
"start": 94,
|
||||
"end": 192,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 104,
|
||||
"end": 119,
|
||||
"name": "complex_generic"
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start": 166,
|
||||
"end": 172,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 72
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 78
|
||||
}
|
||||
},
|
||||
"name": "val",
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start": 169,
|
||||
"end": 172,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 75
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 78
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeReference",
|
||||
"start": 171,
|
||||
"end": 172,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 77
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 78
|
||||
}
|
||||
},
|
||||
"typeName": {
|
||||
"type": "Identifier",
|
||||
"start": 171,
|
||||
"end": 172,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 77
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 78
|
||||
}
|
||||
},
|
||||
"name": "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
{
|
||||
"type": "MustacheTag",
|
||||
"start": 176,
|
||||
"end": 181,
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start": 177,
|
||||
"end": 180,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 9,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 5
|
||||
}
|
||||
},
|
||||
"name": "val"
|
||||
}
|
||||
}
|
||||
],
|
||||
"typeParams": "T extends { bracket: \"<\" } | \"<\" | Set<\"<>\">"
|
||||
}
|
||||
]
|
||||
},
|
||||
"instance": {
|
||||
"type": "Script",
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"context": "default",
|
||||
"content": {
|
||||
"type": "Program",
|
||||
"start": 18,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 0
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"sourceType": "module"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue