This file contains hidden or 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 DetectTypedForm<T> = | |
| T extends Array<infer U> | |
| ? FormArray<DetectTypedForm<U>> | |
| : T extends Date | |
| ? FormControl<Date> | |
| : T extends object | |
| ? FormGroup<TypedForm<T>> | |
| : T extends true | false | |
| ? FormControl<boolean> | |
| : T extends PropertyKey |
This file contains hidden or 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 type {TypedForm} from './typed-form' | |
| type TypedFormModel<T> = { | |
| // Verifique cada tipo do model | |
| [K in keyof T]: TypedForm<T[K]> | |
| } | |
| export type {TypedFormModel} |
This file contains hidden or 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 DOMEventMapDefinitions = [ | |
| [HTMLElement, HTMLElementEventMap], | |
| [Document, DocumentEventMap], | |
| [Window, WindowEventMap], | |
| [FileReader, FileReaderEventMap], | |
| [Element, ElementEventMap], | |
| [Animation, AnimationEventMap], | |
| [EventSource, EventSourceEventMap], | |
| [AbortSignal, AbortSignalEventMap], | |
| [AbstractWorker, AbstractWorkerEventMap], |
This file contains hidden or 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 NxPluginName = | |
| | 'js' | |
| | 'web' | |
| | 'node' | |
| | 'nest' | |
| | 'react' | |
| | 'angular' | |
| | 'express' | |
| type NxProjectType = 'application' | 'library' |
This file contains hidden or 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
| function create<K extends keyof HTMLElementTagNameMap>( | |
| name: K, | |
| attributes: Partial<HTMLElementTagNameMap[K]>, | |
| ...children: Element[] | |
| ): HTMLElementTagNameMap[K] { | |
| const el = document.createElement(name) | |
| if (children) el.append(...children) | |
| return Object.assign(el, attributes) | |
| } |
This file contains hidden or 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 {Observer} from './core/event-emitter' | |
| const observer = new Observer<string>() | |
| const sub1$ = observer.subscribe((value, count) => { | |
| console.log('sub 1: ', value, count) | |
| }) | |
| const sub2$ = observer.subscribe((value, count) => { | |
| console.log('sub 2: ', value, count) |
This file contains hidden or 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 Callback<T> = (value: T) => void | |
| export class EventEmitter<T> { | |
| #on = new Set<Callback<T>>([]) | |
| set on(cb: Callback<T>) { | |
| this.#on.add(cb) | |
| } | |
| set off(cb: Callback<T>) { |
This file contains hidden or 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
| const subtitle = segToSub(subtitles.events); | |
| console.log(subtitle); |
This file contains hidden or 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
| export function query<K extends keyof SVGElementTagNameMap>( | |
| name: K | `${K}.${string}` | `${K}#${string}` | `${K}[${string}]`, | |
| parent?: Element | |
| ): SVGElementTagNameMap[K] | |
| export function query<K extends keyof HTMLElementTagNameMap>( | |
| name: K | `${K}.${string}` | `${K}#${string}` | `${K}[${string}]`, | |
| parent?: Element | |
| ): HTMLElementTagNameMap[K] |
This file contains hidden or 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 './style.scss' | |
| const video = document.querySelector('video') as HTMLVideoElement; | |
| const canvas = document.querySelector('canvas') as HTMLCanvasElement; | |
| const ctx = canvas.getContext('2d', { willReadFrequently: true })!; | |
| // Configuração da tela de fundo | |
| const BACKGROUND_COLOR = [6, 6, 6]; // fundo verde | |
| const TOLERANCE = 80; // tolerância de cor | |
| const OPACITY = 0.7; // opacidade do sujeito |