stackblitz/alien-signals

Add an "I" prefix to the variable of the interface

Closed this issue · 2 comments

I've been reading the alien-signal source code recently, and I've been confused by variable names,
The source code contains Subscriber, which is both an interface and a namespace. The namespace is compiled as a variable in a closure.

For namespace, because a namespace corresponds to a variable and contains a set of methods, it is more like a manager. The recommended name is SystemManager or SystemMgr.
For interface, it is recommended that the interface be prefixed with I. For example, the link is named ILink,

I don't understand your naming rules, if you change the name like this, it should be easy for everyone to read.

image

image

https://www.npmjs.com/package/alien-signals?activeTab=code
image
The problem you encountered is more likely that you enabled some tsconfig rules and automatically generated types.

It is also possible that you may have repeated name definitions when doing secondary packaging.

Directly relying on alien-signals did not reproduce your situation, maybe you should check your own code.

if you change the name like this, it should be easy for everyone to read.

This seems to be subjective, if you want, you can import * as alien from 'alien-signals';

You are a good choice to use alien.Subscriber when using types. At least I personally think it is better to use Subscriber directly in alien-signals.

People are always looking for different styles, such as Interface represented by NestJS/NG must be prefixed with I. But when defining it, it is clear to write interface xxx, isn't it?

Personally, I prefer the private interface prefix plus I, which stands for Internal. emmm~ It's 6:30 on Friday, and it's time to get off work🎉. Have a good weekend~