Note
This document was mostly generated by Claude 3.5 based on my wishes
Here's a draft TC39 proposal for "Trait Call Expression" based on your requirements:
use aes_gcm::{ | |
aead::{generic_array::GenericArray, Aead}, | |
Aes256Gcm, | |
}; | |
async fn decrypt_body( | |
mut response: reqwest::Response, | |
cipher: &Aes256Gcm, | |
) -> anyhow::Result<reqwest::Response> { | |
let mut headers = std::mem::take(response.headers_mut()); |
export function asyncComponent<T>( | |
fn: (props: T) => Promise<JSX.Element> | |
): React.FC<T> { | |
return fn as any; | |
} |
create schema if not exists my_new_schema; | |
alter default privileges for user supabase_admin in schema my_new_schema grant all | |
on sequences to postgres, anon, authenticated, service_role; | |
alter default privileges for user supabase_admin in schema my_new_schema grant all | |
on tables to postgres, anon, authenticated, service_role; | |
alter default privileges for user supabase_admin in schema my_new_schema grant all | |
on functions to postgres, anon, authenticated, service_role; | |
alter default privileges for user postgres in schema my_new_schema grant all | |
on sequences to postgres, anon, authenticated, service_role; | |
alter default privileges for user postgres in schema my_new_schema grant all |
// @ts-check | |
require('path'); | |
const esbuild = require('esbuild'); | |
async function main() { | |
const {plugin, set} = createDependencyPlugin(); | |
await esbuild.build({ | |
bundle: true, |
type Thenable<T> = { | |
then<R, L = never>(onFulfill: (t: T) => R, onError?: (err: any) => L): Thenable<R | L>, | |
catch<L>(onError: (err: any) => L): Thenable<T | L>, | |
} | |
type Result<T> = { type: "value", value: T } | { type: "error", error: any }; | |
/** Wrapper around simple functions that allow you to `.catch` and `.then` for synchronous functions */ | |
function thenable<T>(createT: () => T): Thenable<T> { | |
let resultT: Result<T>; |
type Validator<Input, Error> = (input: Input) => Error[]; | |
type ExtractValidatorError<V extends Validator<any, any>> = V extends Validator<any, infer A> ? A : never; | |
function error<Error>(error: Error): Error[] { | |
return [error]; | |
} | |
function ok(): any[] { | |
return []; | |
} |
function textNodesUnder(el){ | |
var n, a=[], walk=document.createTreeWalker(el,NodeFilter.SHOW_TEXT,null,false); | |
while(n=walk.nextNode()) a.push(n); | |
return a; | |
} | |
for (let node of textNodesUnder(document.documentElement)) { | |
node.nodeValue = node.nodeValue.replace(/[^\s]/g, '█'); | |
} |
type IndexableKeys<T> = { [key in keyof T]: T[key] extends string ? key : never }[keyof T]; | |
function matcher<T>(): <K extends IndexableKeys<T>>(key: K) => <R>( | |
legs: { | |
[key in Extract<T[Extract<K, keyof T>], string>]: (arg: T & Record<K, key>) => R | |
} | |
) => (t: T) => R { | |
return (key) => (legs) => (t) => { | |
const state = t[key]; | |
return legs[state](t); |