Skip to content

Instantly share code, notes, and snippets.

View dagda1's full-sized avatar

Paul dagda1

View GitHub Profile
{
"id" : "728320a7-a4e2-4a16-aa38-621b084c1014",
"name" : "mentorOnboardingFlow",
"type" : "INFRASTRUCTURE",
"processingType" : "SEQUENTIAL",
"author" : null,
"createDate" : "2024-02-28T12:39:35.030+00:00",
"modifyDate" : "2024-02-28T12:39:35.030+00:00",
"parameters" : {
"Sample Selection" : {
'prettier/prettier': [
'error',
{
printWidth: 120,
singleQuote: true,
semi: true,
tabWidth: 2,
trailingComma: 'all',
},
],
import type { Operation, Stream } from "./types.ts";
import { action, resource, suspend } from "./instructions.ts";
import { createChannel } from "./channel.ts";
import { useScope } from "./run/scope.ts";
type EventMap<T extends EventTarget> = T extends WebSocket ? WebSocketEventMap
: T extends MediaQueryList
? MediaQueryListEventMap
: T extends Document
? DocumentEventMap
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false
type Test1 = Equal<[1, 2, '3'], [1, 2, '3']>
// ^? - type Test1 = true
type Test2 = Equal<[1, 2, '3'], [1, 2, 3]>
// ^? - type Test2 = false
{
"extends": "@cutting/eslint-config/react",
"rules": {
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"{}": {
"message": "Use Record<string, unknown> instead",
@dagda1
dagda1 / undefined-order.ts
Created February 7, 2022 15:48
Extend undefined order
type BadUndefinedKeys<T> = {
[P in keyof T]-?: T[P] extends undefined ? P : never
}[keyof T];
type Bad = BadUndefinedKeys<{ foo: number, bar?: string}>; // never
type GoodUndefinedKeys<T> = {
[P in keyof T]-?: undefined extends T[P] ? P : never;
}[keyof T];
@dagda1
dagda1 / UnionTo.ts
Last active February 9, 2022 06:16
// both examples below start
type UnionToXXX<T> = (T extends any ? (t: T) => T : never) extends infer U ? // rest
// Converts { x: string } | { y: number } to { x: string, y: number }
type UnionToIntersection<T, U = T> = (U extends any ? (arg: U) => any : never) extends ((arg: infer I) => void) ? I : never;
// Converts string | number | boolean to [string, number, boolean]
type UnionToTuple<T> = (
(
(
// HERE IS MY ANSWER WITH THE TIME CONSTRAINT REMOVED
// https://github.com/dagda1/guardian-interview/blob/v0/src/index.ts
import inquirer from 'inquirer';
const { prompt } = inquirer;
const commands = ['N', 'S', 'E', 'W'] as const;
type RobotState = 'IDLE' | 'CARRYING';
{
"data": {
"search": {
"repositoryCount": 104,
"pageInfo": {
"endCursor": "Y3Vyc29yOjEwMA==",
"startCursor": "Y3Vyc29yOjE="
},
"nodes": [
{
export type PreserveAspectRatioAlignment =
| 'xMinYMin'
| 'xMidYMin'
| 'xMaxYMin'
| 'xMinYMid'
| 'xMidYMid'
| 'xMaxYMid'
| 'xMinYMax'
| 'xMidYMax'
| 'xMaxYMax';