mirror of https://github.com/sveltejs/svelte
parent
e81fb88f41
commit
864fd313bb
@ -1,11 +1,11 @@
|
||||
import { Node } from '../interfaces';
|
||||
|
||||
export default function nodeToString(prop: Node) {
|
||||
if (prop.value.type === 'Literal' && typeof prop.value.value === 'string') {
|
||||
return prop.value.value;
|
||||
} else if (prop.value.type === 'TemplateLiteral'
|
||||
&& prop.value.quasis.length === 1
|
||||
&& prop.value.expressions.length === 0) {
|
||||
return prop.value.quasis[0].value.raw;
|
||||
export default function nodeToString(node: Node) {
|
||||
if (node.type === 'Literal' && typeof node.value === 'string') {
|
||||
return node.value;
|
||||
} else if (node.type === 'TemplateLiteral'
|
||||
&& node.quasis.length === 1
|
||||
&& node.expressions.length === 0) {
|
||||
return node.quasis[0].value.raw;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
[{
|
||||
"message": "'props' must be an array expression, if specified",
|
||||
"loc": {
|
||||
"line": 5,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 11
|
||||
},
|
||||
"pos": 49
|
||||
}]
|
@ -0,0 +1,7 @@
|
||||
<div></div>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {}
|
||||
};
|
||||
</script>
|
@ -0,0 +1,12 @@
|
||||
[{
|
||||
"message": "'props' must be an array of string literals",
|
||||
"loc": {
|
||||
"line": 5,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 12
|
||||
},
|
||||
"pos": 50
|
||||
}]
|
@ -0,0 +1,7 @@
|
||||
<div></div>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: [{}]
|
||||
};
|
||||
</script>
|
Loading…
Reference in new issue