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

Incorrect documentation instructions: missing types #105

Closed
jorroll opened this issue May 14, 2019 · 5 comments · Fixed by ckeditor/ckeditor5#1927
Closed

Incorrect documentation instructions: missing types #105

jorroll opened this issue May 14, 2019 · 5 comments · Fixed by ckeditor/ckeditor5#1927
Assignees
Milestone

Comments

@jorroll
Copy link

jorroll commented May 14, 2019

The quick start instructions for this module, as described, do not work. Reproduction here: https://stackblitz.com/edit/angular-x2t14d.

The @ckeditor/ckeditor5-build-classic lacks any bundled type definitions, which prevents typescript from compiling the module.

Because there are also no definitions for the module residing in the DefinitelyTyped repo, users must manually add typings for the module. It would be helpful if this step were documented, if only so that users definitively know that they haven't done something wrong (e.g. forgotten to install a package).

Example:

// ckeditor__ckeditor5-build-classic.d.ts

declare module '@ckeditor/ckeditor5-build-classic' {
  const fake: any;
  export default fake;
}

This minimal typescript definition is enough to make the compilation errors go away, but the imported ClassicEditor still will have no types.

I'll also note, that if someone doesn't know how to add custom typings for typescript modules, this example will not be enough information for them. They will need to consult the typescript docs.

@Mgsy
Copy link
Member

Mgsy commented May 15, 2019

cc @ma2ciek

@ma2ciek
Copy link
Contributor

ma2ciek commented May 15, 2019

Hi, @thefliik.

Yep, our builds lack TS definition types. There's a ticket about it: ckeditor/ckeditor5#504. Note that this issue occurs only in the strict mode, without the strict mode it should compile correctly (And actually even with the error the code will compile).

Because there are also no definitions for the module residing in the DefinitelyTyped repo, users must manually add typings for the module.

We're still waiting for some contributions 😄 The fact is, that the API is really big and it requires a lot of work to make it usable.

I've done research about JS code checked by JSDoc annotations in the past - ckeditor/ckeditor5#1415. This would allow us to generate types after the microsoft/TypeScript#7546 is closed. Unfortunately, it's a big task and we don't have enough time right now.

I'm unsure whether we should add some fake type placeholders on the DefinitelyTyped repository. Overall maybe it's a good idea.

@jorroll
Copy link
Author

jorroll commented May 15, 2019

Well for basic usage I'm not sure that type definitions are needed. I just learned of this package today, so obviously I still have a lot to learn, but it appears as though standard usage doesn't involve doing anything with the imported module other than passing it as a variable. i.e. (from the docs)

import * as ClassicEditor from '@ckeditor/ckeditor5-build-classic';

@Component( {
    // ...
} )
export class MyComponent {
    public Editor = ClassicEditor;
    // ...
}

In this case, it seem like simply calling out the lack of type definitions would be all that's needed for most use cases (at least of the angular integration). My own project is in strict mode, but it appears as though an error is also generated when using in stackblitz as well.

Again, as much as anything, referencing the fact that type definitions may be needed, but aren't provided, is useful if only so that users know that they haven't done something wrong (like forget to import a package). When a project explicitly calls out Angular support, it makes me expect to find type definitions (rightly or wrongly). As you say, it's totally reasonable that the project doesn't have type definitions, but it would be helpful to acknowledge their absence. It took me a bit to before I was sure I wasn't doing something wrong.

Obviously not a huge deal, as the lack of type definitions doesn't seem to have a huge impact on this package's usefulness within an Angular app.

@Mgsy Mgsy added the pending:feedback This issue is blocked by necessary feedback. label May 20, 2019
@ma2ciek ma2ciek added status:confirmed type:task This issue reports a chore (non-production change) and other types of "todos". and removed pending:feedback This issue is blocked by necessary feedback. labels May 23, 2019
@ma2ciek ma2ciek added this to the iteration 25 milestone May 23, 2019
@Reinmar
Copy link
Member

Reinmar commented Jun 26, 2019

Unless someone is self-assigning this and planning to work on this in the next 2 weeks, I'm removing this from the iteration.

@ma2ciek ma2ciek removed this from the iteration 25 milestone Jun 26, 2019
@Reinmar Reinmar added this to the backlog milestone Jul 8, 2019
@ma2ciek ma2ciek modified the milestones: backlog, iteration 26 Jul 30, 2019
@ma2ciek ma2ciek self-assigned this Jul 31, 2019
@Reinmar
Copy link
Member

Reinmar commented Aug 12, 2019

Unless someone is self-assigning this and planning to work on this in the next 2 weeks, I'm removing this from the iteration.

OK, it has a PR in ckeditor/ckeditor5#1927.

@mlewand mlewand added type:docs and removed type:task This issue reports a chore (non-production change) and other types of "todos". labels Aug 21, 2019
mlewand added a commit to ckeditor/ckeditor5 that referenced this issue Aug 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants