-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Migrate CKEditor 5 to TypeScript #11704
Comments
I don't know if it's possible for us to stay compatible with that, though. Should we? |
Official typings do not need to be compatible with DT typings. And if official typings somehow contradict those at DT, the official should be the definitive answer (assuming CKEditor is going to be rewritten in TS). |
You team surely know better, but I suggest you start with |
Hi @fedemp! I tried to reach out to you on LinkedIn. Could you check your invitations or write back to me at [email protected]? |
Some ideas for post-MVP:
|
Status Update:What we've done:
It's all on a feature branch yet. But as soon as we'll finish updating the release process (#11720, work-in-progress), we can get to |
When the time comes, open an issue on DefinitelyTyped to remove those. 👍 |
We will, @fedemp. We're going to stabilize them first. |
It's worth mentioning that CKEditor 5 v35.0.0 is out and it's the first version where TS code was used (namely As for what's next... We're right now reviewing #12188 and engine was by far the biggest and most complex package to port. Next packages to migrate: core and utils. Soon, we'll be able to start porting features which should be easy to do concurrently and much much faster. |
Status updateWe released The next milestone is to select API documentation generator and integrate it with our tooling. After it's done, we will go on with other packages that are in JavaScript yet. |
A bit of context here. We decided to treat the |
yeah i think i can deal with that. i'm hacking it already, so i can hack the types too. |
The new alpha release is out: 👉 https://github.com/ckeditor/ckeditor5/releases/tag/v37.0.0-alpha.1. |
There's another issue that is just quasy rellated to this: When using ckeditor from sources without a build, vitest (being esm-first project) complains about CK5 modules not being esm modules, although they seem to should be in its opinion.
Is this something that can be resolved? |
Adding I'm wondering if sources should be marked as ES Module too. I extracted the case to a separate issue: #13673. |
We have some great news for Vue developers! We just released an alpha version of our Vue integration that includes improved TypeScript support. We hope you'll give it a try and share your feedback to help us make sure it works well before we release a stable version. To install it, run We hope to have similar news for the React and Angular folks next week. |
@Inviz I looked into the issues you reported in this comment. I hope my answers below will help.
The You can switch between the two definitions in your IDE using this switch:
Please check if you have installed the alpha version of the both
We don't try to maintain compatibility with DefinitelyTyped typings, so there may be cases like this here and there. The current signature is
I remember seeing this error before we migrated all plugins to TypeScript. Please check if the I also recommend using // Before
class MyEditor extends ClassicEditor {}
MyEditor.builtinPlugins = [];
MyEditor.defaultConfig = {}
// Now
class MyEditor extends ClassicEditor {
public static override builtinPlugins = [];
public static override defaultConfig = {};
} We switched to the second way of defining built-in plugins because it produces better definitions (
This is already fixed in the latest |
@filipsobol Thanks Filip! I can confirm that using your suggestions i managed to fix all the issues I've had. Great job |
@filipsobol Can it be somehow improved that we can jump from types to the code implementation? I think it would be hugely useful at least to jump to compiled js (if not ts). Right now i can only jump to the type it seems in vs code |
@Inviz This is the default behavior of IDEs for libraries that ship definition files, so it's not something we can do at the library level. I don't know about other IDEs, but in VS Code you can right click on the element you want to jump to and select "Go to source definition". |
Hey Filip. You are right, "Go to source definition" does it. For some
reason I thought it should be "Go to implementation". Thanks!
…On Wed, Mar 22, 2023 at 5:01 PM Filip Sobol ***@***.***> wrote:
@Inviz <https://github.com/Inviz> This is the default behavior of IDEs
for libraries that ship definition files, so it's not something we can do
at the library level.
I don't know about other IDEs, but in VS Code you can right click on the
element you want to jump to and select "Go to source definition".
—
Reply to this email directly, view it on GitHub
<#11704 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAVFBKKN5ADP67RQXTXN3W5K5WVANCNFSM5VDMTC5A>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
In Alpha.1 i could not import |
Why do you need it? It's registered by default. We'll be trying to understand whether there are some cases we don't see ourselves but that are valid so we'll be asking every time :) |
Today we released an alpha version of our React integration that includes improved TypeScript support. We hope you'll give it a try and share your feedback to help us make sure it works well before we release a stable version. To install it, run |
Last but not least, the Angular integration has also been updated and released as an alpha for testing. To install it, run |
Hi everyone, I am happy to announce that we have completed the migration of CKEditor5 project to TypeScript! We appreciate all the feedback that we received from the community during this process. For those who are interested, we have documented the migration steps in our documentation (here). We have also created a separate documentation on how to use CKEditor5 in TypeScript projects (here). We would like to invite everyone to provide their feedback in our other ticket (#12027) where we will track our future improvements. Moving forward, we plan to update CKEditor5 Online Builder and ckeditor5-package-generator to use TypeScript, make typings work with DLLs, migrate the inspector to TS, update our Contribution Guide and other documentation to reflect that it is now a TypeScript project, and other miscellaneous stuff. Thank you all for your continued support and contributions. |
Event-based dispatcher dont seem to be typed? e.g. |
Did you use generic types, as can be found in many example usages in the CKEditor 5 workspace? Such as here: ckeditor5/packages/ckeditor5-heading/src/title.ts Lines 106 to 108 in 3fc7651
If not providing a generic argument, you will only have options of the ckeditor5/packages/ckeditor5-utils/src/emittermixin.ts Lines 77 to 83 in 3fc7651
|
thanks. Is there a necessity to provide those types explicitly? It seems that typescript could infer by event name? |
I'd like to bring this up again. Right now if you "Go to source definition" you jump into JS file. Within that file you can jump between functions as well. but any function that is out of that file is |
Is there any demo how to upgrade from builder version of ckeditor to typescript? @arkflpc |
Custom builds produced by the online builder and DLL versions of packages provided by CKEditor 5 do not provide built-in typings yet. We plan to provide the support for those. However, it is possible right now (although not straightforward): see this comment. |
Back in 2015 when we were bootstrapping CKEditor 5 TypeScript wasn't yet mature enough and didn't yet seem as a safe choice taken the long horizon of CKEditor 5's life and fate of e.g. CoffeeScript or Backbone (that were the popular choices at that time).
Nowadays, for a large scale, complex project such as CKEditor 5, TypeScript is a clear choice. We've been actually looking at it for a longer time but it was clear that we need to pick the right moment for a migration. The moment has come 🥳
The main goals of the migration:
We're right now cooking a plan of action, so I won't share more details for now. Some two last points that I want to mention for now are:
Keep your fingers crossed and stay tuned for more information.
The text was updated successfully, but these errors were encountered: