modulepattern whenever possible. But do you know the reason why? Let me explain it to you.
-- Modules are executed within their own scope and not in global scope.
-- Code reusability.
-- Load on demand
-- Easier testing
namespaceif modules is a possibility. Why? As you might end up importing the whole standard namespace into your program which may not be required.
Organize single class into a single file.
Import only required module and retain naming convention.
default exportfor 1 major class and
named exportfor less frequent or related classes
Refrain from using
underscore (_)anywhere, not in field name or get/set. Why? As such a naming convention indicates a name is meant for internal use.
TSLintdoesn't respect the underscore pattern naming convention.
Do not create
asyncif only last return statement has
await. Do not omit
async/awaitwhen catching exceptions.
Will share another article on
async tips soon! Till then happy learning.