vscode-json-to-ts icon indicating copy to clipboard operation
vscode-json-to-ts copied to clipboard

Automatically detect maps (feature request)

Open qpwo opened this issue 3 years ago • 0 comments

Sometimes there are maps in JSON:

{
    "x": 5,
    "y": 6,
    "should_be_in_ts": {
        "metadata": "goes here",
        "or": "whatever"
    },
    "should_be_ts_map_not_an_interface": {
        "key1": {
            "a": 1,
            "b": 2
        },
        "key2": {
            "a": 3,
            "b": 4
        },
        "key3": {
            "a": 5,
            "b": 6
        },
        "key4": {
            "a": 7,
            "b": 8
        },
        "key5": {
            "a": 9,
            "b": 10
        }
    }
}

I wonder if it would be possible to automatically detect these somehow. If for example you each value for should_be_ts_map_not_an_interface had a bunch of different keys then it's probably a map and not an interface. Or if there are a thousand keys, it's definitely a map. Etc.

Thoughts?

qpwo avatar Feb 24 '21 20:02 qpwo