Skip to content

Instantly share code, notes, and snippets.

@jmptr
Last active February 12, 2018 19:26
Show Gist options
  • Select an option

  • Save jmptr/399b49326176b1dc509d756c912072ff to your computer and use it in GitHub Desktop.

Select an option

Save jmptr/399b49326176b1dc509d756c912072ff to your computer and use it in GitHub Desktop.
TypeScript Naming Conventions

How I name my TypeScript modules

Pascal Casing is for Classes

If the module exports a class, then it should use Pascal casing

Examples:

DatabaseRepository.ts

MenuComponent.tsx

HttpApplicationFactory.ts

Camel Casing is for Important Functions and Methods

In cases where a module is used to bootstrap an another module, or to contain a fantastic amount of business logic, it might be useful to name the module after the function within.

Examples:

createHttpApplicatio.ts

createStore.ts

startService.ts

bootstrapApplication.ts

Kebab Casing is for Organizing Functions by Domain

Some modules may contain multiple entities that are only loosely related by the domain, but are more related by type. For example, one suck module may only contain types for a project. Another module may contain functions designed for array.map or array.find.

Examples:

product-types.ts

product-utils.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment