glideapps / quicktype

Generate types and converters from JSON, Schema, and GraphQL
https://app.quicktype.io
Apache License 2.0
12.31k stars 1.07k forks source link

const number type throws error #2516

Open jonnytest1 opened 7 months ago

jonnytest1 commented 7 months ago

this schema doesnt work (in my other example there was also type:"number" but it had the same effect)

{
    "type": "object",
    "properties": {
        "delay": {
            "const": 10
        }
    },
    "$schema": "http://json-schema.org/draft-07/schema#"
}
jonnytest1 commented 7 months ago

i tried adding this at the start of the Javascript.ts#nameStyle method which at least fixes the runtime error unfortunatly it is still treated as a string

protected nameStyle(original: string, upper: boolean): string { if (typeof original === "number") { return original }

image

jonnytest1 commented 7 months ago

found it image

jonnytest1 commented 7 months ago

🤔 now i just need to get out the number |

image

inferrinizzard commented 7 months ago

Looks like a duplicate of #2333 #2371

jonnytest1 commented 7 months ago

true , but mine has a PR linked :3