問題タブ [bucklescript]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
1 に答える
119 参照

ocaml - ネストされた再帰データのデータ型を定義する方法

私はjs側からデータを取得しました。これは、このように見え { "selectionSet": { "type": 1, "selections": [ { "name": { "kind": "Name", "value": "viewer" }, "selectionSet": { "type": 1, "selections": [ { "name": { "kind": "Name", "value": "avatarUrl" }, "selectionSet": null } ] } } ] } } ます。selectionSetselections

を定義するとき、型が のフィールドがあるのでselections定義するべきだったようです。しかし、定義されている場合、定義する必要がありましたselectionSetselectionSetselectionSetselections

誰かがOCamlスタイルで答えることができますか? この JSON 形式のデータをレコードに変換したいと考えています。