datocms / gatsby-source-datocms

Official GatsbyJS source plugin to pull content from DatoCMS
MIT License
140 stars 50 forks source link

Typescript Support #126

Open axelnormand opened 3 years ago

axelnormand commented 3 years ago

Looking forward to using DatoCMS in my new project, thank you for this plugin.

I noticed adding this plugin there is no typescript support. HelmetDatoCms is not typed and i had to add a .d.ts file to my project saying whats exported from gatsby-source-datocms as there is also nothing in Definitely Typed.

Without the .d.ts file typescript complains about the lack of typing for me. I did try adding allowJS: true to my tsconfig but that didn't seem to help.

What is the best way i can help adding these? Ideally you'd want native typescript support in this repo as oppose to possibly out of date types in Definitely Typed?

Thanks

matjack1 commented 1 year ago

Hey Gatsby fans, I'm gauging how much interest for this is there now. For us this would mean a big rewrite as we would need to change the underlying libraries that we are using.

So before taking this big effort we want to know if it would be really useful as of 2023. Please let us know with comments and/or upvotes on this comment. Thanks!

smonfort-cacd2 commented 10 months ago

Hello, To improve the developer experience, we would also be interested in a better Typescript support with a "Strict Mode" additional option in the Gatsby plugin, as mentioned in #198. Currently, any required DatoCMS field is considered as nullable in the inferred TS types, which leads to unpleasant non-null assertions. Thanks!