Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JS/TS decorators naming convention

Are there any naming conventions for decorators (e.g. PascalCase vs camelCase)? I have seen both used in various code snippets.

like image 944
Chris Avatar asked Dec 18 '17 22:12

Chris


People also ask

Does TypeScript use camelCase or snake case?

But as object-oriented derivations of JavaScript, such as TypeScript, AngularJS and Node. JS, gained popularity, camel case has become the standard. Variable naming conventions, such as snake case or camel case, are standardized differently for each programming language.

What is the naming convention for JavaScript?

Names are case-sensitive, lowercase and uppercase are different. Start variable names with a letter, use camelCase for names. Variable names should be self-descriptive, describing the stored value. Boolean variables are usually prefixed with is or has .

Are decorators supported in TypeScript?

Decorators are a stage 2 proposal for JavaScript and are available as an experimental feature of TypeScript.


1 Answers

TypeScript documentation follows @camelCase.

Angular/Ionic documentation follows @PascalCase.

In the absence of any other official guidance - you may choose the one from these 2 that you like, but be consistent in your own codebase.

like image 184
Kirill Groshkov Avatar answered Oct 10 '22 06:10

Kirill Groshkov