Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

typescript style type

type ComponentProps = {
	styles: React.CSSProperties 
}
Comment

typescript style guide

Casing:
  Long: easier to read throug in lists
    MACRO_CASE: constants, enums 
  
    kebap-case: file names, paths
  
    snake_case: API I/O, object properties, variables, function/method attributes. 

  Short: less characters allow us to fit more meaning; e.g. when we extend or scope an entity (both good practices) the name tends to grow 
    camelCase: functions, methods, GraphQL actions
    
    PascalCase for classes and interfaces, cloud infrastructure resource names

Grammar
  variable: a noun (an object or a collection of objects)
  
  function: a verb (an action) against a noun with optional adjunct (e.g. ...FromSomewhere, ...BySomeCriteria)
    When the input attributes are more than two => nest them in a `config` object for readability.
    Prefix private methods with an underscore to be easily distingushable from non-private methods.
    
  interface: descirption of a noun and/or a verb 
    Not putting commas at the end ot each attribute make it an interface declaration easily distinguishable from a an object declaration

  enum: a list of limited options
    key - capital case with underscore
    value - kebap case; If needed we can switch to short casing at any time with simple util like `toPascalCase()`
Comment

PREVIOUS NEXT
Code Example
Typescript :: check if string include numbers in typescript 
Typescript :: sass migrate division vue 
Typescript :: battle cats challenge battle 
Typescript :: create an anonimus object in angular 
Typescript :: read objects to file cpp 
Typescript :: adonis validator exists 
Typescript :: typescript show arguments on function call vscode 
Typescript :: html image with its text below 
Typescript :: if exists certain line in sql table java condition 
Typescript :: how to use typescript on createRoot 
Typescript :: typescript create guid 
Typescript :: installing bootstrap in angular 9 
Typescript :: how to reset stats in diablo 2 
Typescript :: randomly choose n rows from a file linux 
Typescript :: add correct host key in known_hosts to get rid of this message 
Typescript :: contract in solidity 
Typescript :: see sheets of excel file python 
Typescript :: how to get value_counts output in dataframe format 
Typescript :: angular typescript set meta data 
Typescript :: why is a tree set sorted 
Typescript :: typescript check if element in array 
Typescript :: python first n elements of list 
Typescript :: how to route to another page in angular 
Typescript :: typescript key options from array values 
Typescript :: react forwardref typescript 
Typescript :: sort two lists that refence each other 
Typescript :: number of elements in c++ array 
Typescript :: typeorm findAndCount orderby 
Typescript :: import openzeppelin contracts in remix 
Typescript :: tostring kotlin 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =