Typings, typings, typings. It’s the most upvoted feature on feedback.strapi.io, and we’ve been refining it even more. As we put quality and safety first, the release of full Typescript support, initially forecasted with the stable release of 4.2 has met with a small delay from our QA team, which works hard to ensure we deliver the highest safety and quality standards.
This is why we decided to release it today as part of the 4.3.0.beta.1 to allow further development and testing from the Strapi community. In the next weeks, we’ll work on adding more features like:
- Schema Typings: you’ll get every type and utility to create schema typings. This base will allow to automatically create types for each Strapi API, with the highest precision.
- Automatic Type Generation: this will allow you to automatically generate typings to match your schema, and indexed by your app so that you can use them in every other util.
Check the changelog here and test this beta version by running this command:
npx create-strapi-app@beta my-project --ts
Looking forward to reading your feedback
Hey man, this is a cool feature I’ve been looking forward to.
I think the command you posted isn’t up to date. It’s missing the --ts flag, no?
Also, I think the Type-generation features might still be pending review before the PR is included, I’m not 100%, but it looks that way and I’m waiting for a response in Discord. I’ve tried to generate using 4.3.0.beta-1 and it doesn’t know the command, so anyone else trying this should check here or Discord for the current state of play.
GitHub PR: https://github.com/strapi/strapi/pull/13460
Indeed you can add the
--typescript flag in order to use TypeScript in your Strapi application using the latest beta. I’ve edited the initial post to reflect that.
Concerning the schema types and their automatic generation, the initial post states that
In the next weeks, we’ll work on adding more features like …
So they’re indeed still in review and can be expected in the next beta releases
Have a nice day!
Ah, ok, thanks for the info, there was some confusing chatter on Discord about it, so I’d used the flag.
I didn’t spot that phrase ‘in the next weeks’, damn. Thanks for the update, though! I upgraded from v3 thinking this was already available My fault for not seeing the PR was still open, either.
I wonder, if in the meantime there’s an example of the types/files/folder generated? That would be really handy to avoid the clouds of doubt. It looks like I’ll have to create my own and I don’t want to stray too far from the expected structure (for reference, my V3 code was using Strapi-To-Typescript package).
Just letting you know that the automatic schema types generation has been released in the latest beta version of strapi. More information here.
just to let cha now that this seems to dosen’t work with PowerShell on windows, hover works in git bash
Great stuff! Thanks, I’m trying it now.
Thank you so much! Are there any migration guides for migrating to TypeScript?
As in the documentation:
Right now what I am doing is creating a new project and migration file by file. But yet I am struggling.