Skip to content

Instantly share code, notes, and snippets.

View minenwerfer's full-sized avatar

minenwerfer

  • [object Object]
View GitHub Profile
local vim = vim
local Plug = vim.fn['plug#']
vim.opt.hidden = true
vim.opt.number = true
vim.opt.exrc = true
vim.opt.relativenumber = true
vim.opt.inccommand = 'split'
vim.opt.expandtab = true
vim.opt.showmatch = true
export type ObjectToSchema<TObject, TRequired extends string[] | null = null> = TObject extends readonly [infer K]
? ValueToProperty<[K]>
: keyof TObject extends never
? { type: 'object' }
: {
[P in keyof TObject]: TObject[P] extends infer Value
? ValueToProperty<Value>
: never
} extends infer Properties
? TRequired extends null
#!/bin/bash
function getSpan() {
year="$1"
month="$2"
dayMin="$3"
dayMax="$4"
date="$year-$month-$d"
// @ts-check
import vueRouter from 'unplugin-vue-router/vite'
/** @type {import('aeria-ui-build').InstanceConfig} */
export default {
site: {
title: 'Quickstart',
signinText: 'Admin panel',
signupForm: true,
},

node_modules/.aeria/package.json

{
  "exports": {
    "collections": {
      "import": "dist/collections/index.mjs",
      "require": "dist/collections/index.js",
      "types": "dist/collections/index.d.ts",
    }
@minenwerfer
minenwerfer / deep-merge.ts
Last active February 6, 2024 02:40
Deep merge two objects in Typescript, including arrays
/**
* This utility type merges two objects together while handling arrays.
* An intersection of objects (L & R) can behave oddly when dealing with arrays:
*
* Typescript doesn't complain about a type error in t.a, because never[] & 'something'[] => never
* declare const t: { a: readonly [] } & { a: readonly 'something'[] }
* t.a[0] === 'x'
*
* Likewise, the below is also valid, because readonly 'a'[] & readonly 'b'[] also results in never
* because both types don't overlap with each other and ts won't turn them into ('a' | 'b')[] like