notes

2021. 3. 19.
isReactElement

const isReactElement = (element: ReactNode): element is ReactElement =>
  element !== null && typeof element === 'object' && 'props' in element;
const isReactElement = (element: ReactNode): element is ReactElement =>
  element !== null && typeof element === 'object' && 'props' in element;

2021. 3. 9.
Patch broken node_module with yarn2

  1. yarn patch <module>
  2. fix the code inside the generated folder and save it.
  3. yarn patch-commit <generated_folder> > <patch_file_name>.diff
  4. fix package.json with "module": "patch:<module>@<version>#<path_to_patch_file>/<patch_file_name>.diff"
  5. yarn install

2021. 1. 21.
as const

2021. 1. 11.
type predicate

interface Article {
   title: string;
   body: string;
}

function isArticle(body: unknown): body is Article {
  let b = body as Article;
  return !!b && typeof b.body === 'string' && typeof b.title === 'string';
}
interface Article {
   title: string;
   body: string;
}

function isArticle(body: unknown): body is Article {
  let b = body as Article;
  return !!b && typeof b.body === 'string' && typeof b.title === 'string';
}