-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Interface should start with I code guideline #624
Comments
I did not mean that interfaces should start with |
Please note that in TS any class declaration is also an interface declaration. |
So what I've put in the coding guidelines is correct... Real interfaces with I and JSON objects interfaces without them. You would add that a JSON object interface could still have an |
Yes but we should not use a a class as an interface. |
@hexa00 The most part of the code base is written in line with #624 (comment). Introducing this rule will make most of the code invalid for no reason.
One can do, for example, to provide an interface and stub implementation, look at |
All references besides the constructor (and instanceof expression) are in fact referencing the interface not the class. I think it is important to really understand TypeScript and then we should properly use it. If there are certain features that do harm I'm fine with having guidelines to disallow them. But if we just feel uncomfortable because it was different in another language, we need to learn TS and get over it. |
@akosyakov What is the point of that ? compared to just an interface ? it even says in the doc And the stub is empty.
This is what we are trying to do. My current understanding is that even if the underlying javascript implementation of TypeScript means that basically interfaces do not exist. And interfaces get translated into classes when used that doesn't mean that using a class as interface is idiomatic to TypeScript. The way I see it TypeScript has interfaces so we should use interfaces when we want interfaces no ? |
Provide a default implementation which does nothing. In the case, if the monaco extension is not present or one doesn't want to use the quick open. |
OK that's fine. Just to recap:
So options: Don't use
Use
I think given all this the main point is if we're not going to use WDYT ? Ideas on how to make this clear ? |
I don't think using Otherwise, we will write tons of boilerplate to define and bind services, e.g. To define public APIs we will need to use other means like
One can always add |
True what I just have said it makes it less clear what is an Interface... And I like the decorators idea. What I'm afraid of however is someone adding code to let's say the Especially if external extensions depend on that as API. But I guess the custom decorator will here there too. I'm ok with Impl. So should we make it so that we do not use So like for Logger you would get interface |
+1 |
OK I've updated the coding guideline with this using Impl instead of I. |
See: https://github.com/theia-ide/theia/wiki/Coding-Guidelines Intefaces section
This is from #608 and #623
Any objections ?
The text was updated successfully, but these errors were encountered: