With the following route setup:
import {type} from 'arktype'
const flightDetailSchema = type({
step: 'number',
option: 'number.integer',
interface Success<T> { | |
result: T | |
exception?: never | |
} | |
interface Failure { | |
result?: never | |
exception: {getError: () => unknown} | |
} |
You are an expert AI programming assistant that primarily focuses on producing clear, readable React and TypeScript code. | |
You always use the latest stable, modern version of TypeScript, JavaScript, React, Node.js, Tanstack React Router, Tanstack React Query, HeroUI (formerly NextUI), Tailwind CSS, Vitest and you are familiar with the latest features, best practices and standards. Remember to check `package.json` to see our libraries/packages and make the full use of them. | |
You keep your code clean, readable, and maintainable, fix all linting and formatting errors/warnings, and make sure the code is up to date with the latest standards. | |
You carefully, slowly and methodically, step by step, and outline your reasoning to provide accurate, factual, thoughtful answers, and are a genius at reasoning ai to chat, to generate Code Style, Structure, Naming Conventions, TypeScript Usage, UI and Styling, Performance Optimization. | |
You always check if a similar work has been done before, and if so, you would reference it to |
import 'react' | |
declare module 'react' { | |
/* eslint-disable @typescript-eslint/no-explicit-any -- its intentional */ | |
/* | |
* Use this type to make sure that the callback passed will always be a memoized callback | |
* For any function type, wrap it with MemoizedCallback<T> | |
* Example: MemoizedCallback<(param: number) => boolean> | |
*/ | |
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type -- its intentional |
diff --git a/lib/utils/common.js b/lib/utils/common.js | |
index 90415975e33ea77d161df0329d3ed2426977c404..aa02006b46bb6a5d9143d8b86679e782a9fc06f7 100644 | |
--- a/lib/utils/common.js | |
+++ b/lib/utils/common.js | |
@@ -1,11 +1,14 @@ | |
-"use strict"; | |
+'use strict' | |
+ | |
+const {get} = require('http') | |
+const {type} = require('os') |
type Data = { | |
id: string; | |
}; | |
const data: Data = { | |
id: "123", | |
name: "Hello!", | |
} | |
const data2 = { |
export default function isolate<T extends (...args: unknown[]) => unknown>(fn: T): T { | |
// eslint-disable-next-line @typescript-eslint/no-implied-eval -- workaround | |
return new Function(` | |
with (new Proxy({}, { | |
has () { return true; }, | |
get (target, property) { | |
if (typeof property !== 'string') return target[property]; | |
throw new ReferenceError(property + ' accessed from isolated scope'); | |
}, | |
set (target, property) { |
export function detangle() { | |
let blocked = false | |
return callback => (...args) => { | |
if (blocked) return | |
blocked = true | |
callback(...args) |
#!/bin/sh | |
TARGET_DIR=node_modules | |
if [ ! -d $TARGET_DIR ]; then | |
echo "$TARGET_DIR" does not exist | |
exit 1 | |
fi | |
PATTERNS=" |
function bigIntToFloatString(value: bigint, decimalPlaces: number) { | |
if (typeof decimalPlaces !== 'number' || decimalPlaces < 0 || !Number.isInteger(decimalPlaces)) { | |
throw new TypeError('The second argument must be a non-negative integer'); | |
} | |
const divisor = BigInt(10 ** decimalPlaces); // 1e{decimalPlaces} | |
const integerPart = value / divisor; | |
const fractionalPart = value % divisor; |