Skip to content

Conversation

@stafyniaksacha
Copy link
Contributor

What does it do?

These changes allow loading .cjs, .mjs and .ts files for any part of strapi server without any extra configuration for the client:

  • apis (routes/controllers/services/contentTypes)
  • middlewares
  • policies
  • extensions
  • plugins
  • configurations files

I've used jiti which describe itself to be a "Runtime typescript and ESM support for Node.js (CommonJS)"

Why is it needed?

This allows developers to use typescript in their application or plugins

How to test it?

I have made a working template https://github.com/stafyniaksacha/strapi-typescript-sample

git clone git@github.com:stafyniaksacha/strapi-typescript-sample.git
cd strapi-typescript-sample
yarn
yarn develop # or yarn start

What does it do not?

This PR does not aim to provide strapi core types, but only to add the ability to use strapi with typescript and ESM modules

@strapi-bot
Copy link

This pull request has been mentioned on Strapi Community Forum. There might be relevant details there:

https://forum.strapi.io/t/v4-released-but-what-about-typescript/12948/7

@alexandrebodin
Copy link
Member

Hi @stafyniaksacha thanks for the work ! We are soon going to start working on typescript support and this will probably help us a lot 💯

@alexandrebodin alexandrebodin added flag: don't merge This PR should not be merged at the moment issue: enhancement Issue suggesting an enhancement to an existing feature source: core:strapi Source is core/strapi package labels Feb 11, 2022
@oriooctopus
Copy link

@alexandrebodin that's great to hear! When do you think typescript support will be available?

@nghiepdev
Copy link

Hey, Can tell me which future release version will support Typescript? 5.0 or 4.2.

@stafyniaksacha
Copy link
Contributor Author

5.0 or 4.2

@nghiepit Never heard about Typescript 5.x, what will changes ? Typescript has adopted a non-breaking release cycle through, so things should continue to work on later version.

@alexandrebodin
Copy link
Member

I think the question was referring to Strapi's version :) it is planned to be part of the v4 not v5 of Strapi

@alexandrebodin alexandrebodin added pr: enhancement This PR adds or updates some part of the codebase or features and removed issue: enhancement Issue suggesting an enhancement to an existing feature labels Mar 2, 2022
@derrickmehaffy
Copy link
Member

@alexandrebodin / @Convly due to what is currently being worked on should we close this (no offence to you @stafyniaksacha, we have discussed in private ;) )

@stafyniaksacha stafyniaksacha deleted the feat/typescript-mjs branch March 15, 2022 22:36
@stafyniaksacha stafyniaksacha restored the feat/typescript-mjs branch March 15, 2022 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flag: don't merge This PR should not be merged at the moment pr: enhancement This PR adds or updates some part of the codebase or features source: core:strapi Source is core/strapi package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants