✅ Correto | ❌ Incorreto |
---|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useCallback, useEffect, useRef } from 'react'; | |
/** | |
* Hook that provides start and stop functions to handle AnimationFrame API. | |
*/ | |
const useAnimationFrame = () => { | |
const handleRef = useRef<null | number>(null); | |
const stop = useCallback(() => { | |
if (!handleRef.current) return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const vm = require('vm'); | |
const createContext = () => { | |
const context = Object.create(null); | |
return vm.createContext(context); | |
}; | |
const execute = (code) => { |
-
Advanced TypeScript - Stefan Baumgartner
https://fettblog.eu/advanced-typescript-guide/
No blog do Stefan, o fettblog, existe o guia de typescript avançado. Esse guia é um artigo que exibe outros artigos do blog numa lista, por ordem de complexidade e agrupados por tema. Os artigos explicam tópicos super úteis em TypeScript com bons exemplos e uma didática fantástica.
O conteúdo está em inglês.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useCallback, useMemo, useState } from 'react'; | |
type ValueOrPromiseValue<Value> = Value extends Promise<infer PromiseValue> | |
? PromiseValue | |
: Value; | |
const useLoading = () => { | |
const [ticks, setTicks] = useState(0); | |
const withLoading = useCallback( |
-
Slides (Link para download em PDF)
https://drive.google.com/file/d/1Ua8XnRrwkXDb5DfI7RxWlW_qiJPfr1d5/view?usp=sharing
-
Slides (Link do Speaker Deck)
-
Casos de uso do Maybe/Option e Either
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as Maybe from './main'; | |
// ..:: Contexto ::.. | |
enum LanguageEnum { | |
PORTUGUESE = 'pt-BR', | |
ENGLISH = 'en-US', | |
} | |
type User = { |
- Descomentar
certificateDownloadedAt
quando a PR shawee-io/community-back#622 for mergeada.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Transforms blob to base64 using FileReader API. | |
* @param blob - A blob instance. | |
*/ | |
const fromBlobToBase64 = (blob: Blob): Promise<string> => { | |
return new Promise((resolve, reject) => { | |
const reader = new FileReader(); | |
reader.onerror = (): void => { | |
reject(reader.error ?? new Error('Unknown error on FileReader.')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type JsonObject = { [property: string]: Json }; | |
type JsonArray = Json[]; | |
type Json = null | boolean | number | string | JsonObject | JsonArray; | |
type NodeOf<T extends Json> = T extends JsonObject | |
? T | |
: T extends JsonArray | |
? T[number] |