Skip to content

Bug: Template literal types compiles to array of strings #575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Komock opened this issue Oct 2, 2023 · 1 comment
Closed

Bug: Template literal types compiles to array of strings #575

Komock opened this issue Oct 2, 2023 · 1 comment

Comments

@Komock
Copy link

Komock commented Oct 2, 2023

Stackblitz demo - https://stackblitz.com/edit/stackblitz-starters-8zhuuy?file=schema.json
I'm trying to compile schema for the following type:

type HexColor = `#${string}`;

export type InputType = {
  background: HexColor;
}

Result

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "properties": {
        "background": {
            "items": {
                "type": "string"
            },
            "type": "array"
        }
    },
    "type": "object"
}

Expected

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "properties": {
        "background": {
            "type": "string"
        }
    },
    "type": "object"
}

Or I do something wrong? 🤔

@MyzBai
Copy link

MyzBai commented Nov 20, 2023

duplicate of #426. Has been fixed in 0.61.0

@Komock Komock closed this as completed Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants