dohomi / storyblok-generate-ts

Generates TypeScript interface types based on Storyblok component file
MIT License
102 stars 33 forks source link

Storyblok number field is a string in JSON response not a number #44

Closed dlhck closed 1 year ago

dlhck commented 1 year ago

Currently the generated types are generic number but in reality numbers are a string in the json response:

image image

So I think we should switch to a string generic type instead to use parseFloat without any type-casting.

dohomi commented 1 year ago

I always wonder about this one: is this a flaw of Storyblok API? Or is this because the response can't handle integers?

dlhck commented 1 year ago

The first screenshot above is straight from the "Published JSON" link in the actions dropdown on the story edit view. I think it is a flaw 😓