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 { createWriteStream, writeFileSync } from 'node:fs'; | |
| import { createServer, request } from 'node:http'; | |
| // Settings // | |
| const TARGET_HOST = '127.0.0.1'; | |
| const TARGET_PORT = 8545; | |
| const PROXY_PORT = 8546; | |
| // Server // |
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 BuildTuple< | |
| L extends number, | |
| T extends any[] = [], | |
| F = unknown, | |
| > = `${L}` extends `-${number}` | |
| ? never | |
| : T["length"] extends L | |
| ? T | |
| : BuildTuple<L, [...T, F], F>; |
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
| /** | |
| * Get the length of a string. | |
| * | |
| * @example | |
| * ```ts | |
| * type L = Length<"hello">; // 5 | |
| * ``` | |
| */ | |
| type Length< | |
| T extends string, |
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
| /** | |
| * Get a superset of `T` that allows for arbitrary properties. | |
| * | |
| * @example | |
| * | |
| * ```ts | |
| * interface Order { | |
| * account: `0x${string}`; | |
| * amount: bigint; | |
| * } |
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 { PutObjectCommand, S3Client } from "@aws-sdk/client-s3"; | |
| const currentPath = []; | |
| const csvRows = ["test_name,duration,passed,error,skipped,skip_message,logs"]; | |
| let pendingRow; | |
| let diagnostics = []; | |
| /** | |
| * A test reporter that formats results as CSV and uploads to S3. | |
| * @see https://nodejs.org/api/test.html#custom-reporters |
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
| /** | |
| * Creates a new type that only includes properties from `T` that match the | |
| * structure defined in `M`. Useful for creating a subset of an object type | |
| * based on a mask/template type. Handles special cases for built-in objects | |
| * (Functions, Maps, Sets, Arrays) by preserving their structure rather than | |
| * attempting to deeply map their properties. | |
| * | |
| * | |
| * @example | |
| * ```ts |
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
| // 🚧 WIP 🚧 // | |
| /** | |
| * Get the first member of a tuple, {@linkcode T}, that is more or as specific | |
| * as the member following it. | |
| * | |
| * @example | |
| * ```ts | |
| * type Status = "success" | "error" | "idle" | |
| * type ActiveStatus = "success" | "error" |
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
| /** | |
| * Construct a type in which only a single member of `T` is valid at a time. | |
| * | |
| * @example | |
| * ```ts | |
| * type U = OneOf< | |
| * | { | |
| * a: string; | |
| * } | |
| * | { |
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 { useEffect, useState } from "react"; | |
| /** | |
| * A hook to observe the intersection of elements and return the IDs of those | |
| * that are intersecting. | |
| * @param ids The IDs of the elements to observe | |
| * @param options The options to pass to the IntersectionObserver | |
| * | |
| * @example | |
| * ```tsx |
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
| /** | |
| * Convert members of a union to an intersection. | |
| * | |
| * @example | |
| * ```ts | |
| * type Union = { a: number } | { b: string }; | |
| * type Intersection = UnionToIntersection<Union>; | |
| * // { a: number } & { b: string } | |
| * ``` | |
| * |