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
| #!/usr/bin/env bash | |
| # benchmark-tsc.sh — Compare `tsc --build` times across two git branches. | |
| # | |
| # Usage: | |
| # bash scripts/benchmark-tsc.sh | |
| # | |
| # Override defaults via env vars: | |
| # N=5 bash scripts/benchmark-tsc.sh | |
| # BRANCH_A=main BRANCH_B=feat/foo bash scripts/benchmark-tsc.sh | |
| # |
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 path from "path"; | |
| import { Project, ts } from "ts-morph"; | |
| const packageName = "assistant"; | |
| const packageDir = `packages/${packageName}`; | |
| const project = new Project({ | |
| tsConfigFilePath: path.resolve(`${packageDir}/tsconfig.json`), | |
| }); |
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 path from "path"; | |
| import { type FormatCodeSettings, Project } from "ts-morph"; | |
| const packageName = "assistant"; | |
| const formatSettings: FormatCodeSettings = { | |
| ensureNewLineAtEndOfFile: true, | |
| indentSize: 2, | |
| }; |
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
| /* eslint-disable @typescript-eslint/no-explicit-any */ | |
| type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ( | |
| k: infer I, | |
| ) => void | |
| ? I | |
| : never; | |
| export type UnionToTuple<T, R extends any[] = []> = [T] extends [never] | |
| ? R | |
| : UnionToIntersection<T extends any ? (t: T) => void : never> extends ( |
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, useRef } from "react"; | |
| export const useRenderCount = (label: string) => { | |
| const count = useRef(0); | |
| useEffect(() => { | |
| count.current += 1; | |
| // eslint-disable-next-line no-console | |
| console.log(`${label} render count:`, count.current); | |
| }); | |
| }; |
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 const hasDefinedKey = | |
| <K extends PropertyKey>(key: K) => | |
| <T extends Partial<Record<K, unknown>>>( | |
| obj: T, | |
| ): obj is T & Record<K, Exclude<T[K], undefined>> => | |
| key in obj && obj[key] !== undefined; |
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 Split< | |
| V extends string, | |
| S extends string, | |
| > = V extends `${infer Head}${S}${infer Rest}` | |
| ? [Head, ...Split<Rest, S>] | |
| : Array<V>; | |
| const split = <V extends string, S extends string>( | |
| value: V, | |
| separator: S, |
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 { Model } from '@effect/sql'; | |
| import { PgClient } from '@effect/sql-pg'; | |
| import { layer } from '@effect/vitest'; | |
| import { | |
| Array, | |
| Config, | |
| Effect, | |
| Exit, | |
| Fiber, | |
| flow, |
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 { Schema } from '@effect/schema'; | |
| import { AST } from '@effect/schema'; | |
| import { effectTsResolver } from '@hookform/resolvers/effect-ts'; | |
| import { Button } from '@inato/ui'; | |
| import { Match, Option } from 'effect'; | |
| import type { | |
| FieldValues, | |
| SubmitErrorHandler, | |
| SubmitHandler, | |
| } from 'react-hook-form'; |
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 { ArrayFormatter, Schema } from '@effect/schema'; | |
| import { Effect, Either, flow, Record } from 'effect'; | |
| import { Suspense, use, useActionState } from 'react'; | |
| const updateName = async (name: string) => { | |
| await Effect.runPromise(Effect.sleep(2000)); | |
| return name; | |
| }; | |
| type State<T> = |
NewerOlder