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 { z } from "zod" | |
export default function Validate< | |
Arg extends any, | |
Fn extends (value: Arg) => any | |
>(schema: z.ZodType<Arg>) { | |
return function decorator( | |
_: any, | |
__: any, | |
propertyDescriptor: TypedPropertyDescriptor<Fn> |
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
module.exports = { | |
env: { | |
browser: true, | |
es2021: true, | |
node: true, | |
}, | |
extends: [ | |
"eslint:recommended", | |
"plugin:@typescript-eslint/recommended", |
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
interface InternalTask { | |
id: string; | |
priority: number; | |
symbol: string; | |
text: string; | |
} | |
export function useTasks<TaskType extends string>( | |
typeMap: { |
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 "dotenv/config"; | |
import { Command } from "commander"; | |
import React from "react"; | |
import { render } from "ink"; | |
import { addOptions } from "./helpers/cli/options"; | |
import { PushCommand } from "./commands/push"; | |
const program = new Command(); |
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 type Fn<Input = any, Output = any> = (input: Input) => Output; | |
export type Chain<Fns extends Fn[]> = | |
// We chain two functions at one time | |
Fns extends [infer Fn1, infer Fn2, ...infer RestFns] | |
? // Make sure two elements are functions | |
Fn1 extends Fn<infer Fn1Argument> | |
? Fn2 extends Fn<infer Fn2Argument> | |
? RestFns extends Fn[] | |
? // Rest of the elements exist |
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
class F { | |
f = "I am F" | |
} | |
class A extends F { a = "I am a" } | |
class B extends F { b = "I am b" } | |
class C extends F { c = "I am c" } | |
interface Something<T extends { [i: string]: F } = {}> { | |
register: <K extends string, C extends F>(name: K, classInstance: C) => Something<T & { [key in K]: C }> |
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 discord from 'eris' | |
import { Module, Server } from '../../server' | |
export interface DiscordEvents { | |
clientConnected: [] | |
} | |
interface DiscordModuleInjected { | |
startClient: () => Promise<void> | |
} |
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 fs from "fs"; | |
import path from "path"; | |
import { SourceMapConsumer } from "source-map"; | |
type Nullable<T> = T | null; | |
export interface ParsedCallSite { | |
fileName: Nullable<string>; | |
line: Nullable<number>; | |
column: Nullable<number>; |
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 { blue, green, red, yellow } from "colorette"; | |
import { relative } from "path"; | |
// @ts-expect-error | |
import stringify from "string.ify"; | |
interface IObject<V> { | |
[K: string]: V; | |
} |
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 class AppError extends Error { | |
public readonly name: string; | |
public readonly isOperational: boolean; | |
public readonly cause?: Error; | |
public readonly additionalProps: { [additionalProps: string]: unknown }; | |
constructor({ | |
name, | |
message, | |
isOperational, |