glideapps / quicktype

Generate types and converters from JSON, Schema, and GraphQL

Home Page:https://app.quicktype.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

const number type throws error

jonnytest1 opened this issue · comments

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#"
}

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

found it
image

🤔 now i just need to get out the number |

image

Looks like a duplicate of #2333 #2371

true , but mine has a PR linked :3