Skip to content

generate-typescript-typedefs sets type string for number field values #188

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

Open
m4w opened this issue May 8, 2025 · 0 comments
Open

generate-typescript-typedefs sets type string for number field values #188

m4w opened this issue May 8, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@m4w
Copy link

m4w commented May 8, 2025

Current behavior:
We use the generate-typescript-typedefs command to generate our types. But we noticed an issue: When we choose the field type 'number' in storyblok the generated type will be string, which is very unexpected, since this is a very easy type.

Expected behavior:
The type of a field-type number should be number as well.

Steps to reproduce:
Create a new Storyblok Block, with one field type number. Save that block.
Use the generate-typescript-typedefs command to generate the types for this new block. Notice that the new field-type has the type string instead of number.

An example components.json schema:

{
  "name": "some_block",
  "display_name": "Some Block",
  "schema": {
    "columns": {
      "type": "number",
      "pos": 0,
      "min_value": 2,
      "max_value": 3,
      "default_value": "2",
      "steps": 1
    }
  }
}

And the related typings:

export interface SomeBlockStoryblok {
  columns?: string
}
@m4w m4w added the bug Something isn't working label May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant