V
V
Vika Marmeladka2021-12-27 15:56:54
typescript
Vika Marmeladka, 2021-12-27 15:56:54

What is the best way to name interfaces and types in TypeScript?

I heard some write prefixes, but la, for interface (i), for type (t) at the beginning. Write names in PascalCase and keys in CamelCase.
What do you think is better?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-12-27
@vabka

Names of types/interfaces/classes/enams in PascalCase.
Methods, properties, fields - in camelCase
Interfaces/types/classes don't need prefixes.
But if you really want to, you can give interfaces the prefix "I" if they will be implemented by some class in the future.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question