Skip to content
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

Typescript - Using the 'model.ts' file [ I added a post at the bottom on guide to implement Strapi types in the frontend. #102

Open
DimitriPSN opened this issue Nov 8, 2023 · 1 comment
Labels

Comments

@DimitriPSN
Copy link

Hi,

I'm looking at the project code and the way you've configured Strapi to see the different options and possibilities offered by the CMS.

I notice that there's a file named 'model.ts' located in 'frontend\src\app[lang]\utils\model.ts'. However, this file is never called up, so the interfaces are never used.
Is this intentional or an oversight ?

For example, the file named 'Hero.tsx' located in 'frontend\src\app[lang]\components\Hero.tsx' has a 'Picture' interface, but it could use the one in the 'Model' file.

@PaulBratslavsky
Copy link
Contributor

PaulBratslavsky commented Dec 3, 2023

@DimitriPSN We did not implement Strapi types in this project. Since when this was build we were still making TypeScript enhancements in Strapi.

So the Model.ts file was never used. The issue is that Strapi regenerates its when ever you add new collection types or fields. So in order to get those dynamic types we would need to do more work.

Checkout this article on current TS implementation in your frontend https://strapi.io/blog/improve-your-frontend-experience-with-strapi-types-and-type-script

It show the current work around on how to use Strapi types while we wait to build our SDK.

@PaulBratslavsky PaulBratslavsky changed the title Typescript - Using the 'model.ts' file Typescript - Using the 'model.ts' file [ I added a post at the bottom on guide to implement Strapi types in the frontend. Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants