#Histoire ## 事象 以下のコード。 ```ts interface Props { firstLabel?: string; secondLabel: string; thirdLabel: string; } const props = withDefaults(defineProps<Props>(), { firstLabel: "first", }); ``` `Props`は同じ`string`なのに`firstLabel`とそれ以外で型が異なる。Optionalの有無や[[ケバブケース]]、propsの指定有無は一切関係なく2つ目以降がJSONになるっぽい。 ![[Pasted image 20220607233219.png]] ## 原因 不明 ## 対策 JSON型には値として記載する。文字列なら`"hoge"`、数字なら`16`のように。こんな風に認識されるので実用上は問題ない。 ![[Pasted image 20220607234807.png]]