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 { expectTypeOf, test } from 'vitest'; | |
| test('Join', () => { | |
| type Values = ['a'] | ['a', 'b'] | ['a', 'c'] | ['c', 'd', 'e']; | |
| type Result = Join<Values, '.'>; | |
| type Expected = 'a' | 'a.b' | 'a.c' | 'c.d.e'; | |
| expectTypeOf<Result>().toEqualTypeOf<Expected>(); |
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 { mkdirSync, readdirSync, readFileSync, utimesSync, writeFileSync } from 'fs'; | |
| import { join } from 'path'; | |
| type Book = { | |
| _id: string; | |
| name: string; | |
| }; | |
| type Note = { | |
| _id: 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
| #!/usr/bin/env bash | |
| session=$(systemctl --user show-environment | grep '^BW_SESSION=' | sed 's/^BW_SESSION=//') | |
| if [ -n "$session" ]; then | |
| items=$(bw --session "$session" list items) | |
| [ "$?" -ne 0 ] && unset session | |
| fi | |
| if [ -z "$session" ]; then |
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
| /* cspell:disable */ | |
| export {}; | |
| declare module 'solid-js' { | |
| namespace JSX { | |
| interface MjmlMjmlAttributes { | |
| /** if set to "desktop", switch force desktop version for older (self-hosted) version of Outlook.com that doesn't support media queries (cf. this issue) (default = none) */ | |
| owa?: string /* string */; | |
| /** used as <html lang=""> attribute (default = und) */ |
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 { JSX } from 'solid-js'; | |
| function assert(condition: unknown, message: string): asserts condition { | |
| if (!condition) { | |
| throw new Error(message); | |
| } | |
| } | |
| type Values = Record<string, JSX.Element | ((children: JSX.Element) => JSX.Element)>; |
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 { | |
| SerializedError, | |
| createSelector, | |
| createSlice, | |
| isAsyncThunkAction, | |
| isFulfilled, | |
| isPending, | |
| isRejected, | |
| } from '@reduxjs/toolkit'; |
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 { useReducer, useMemo } from 'react' | |
| type UseSetReturn<T> = [ | |
| Set<T>, | |
| { | |
| add: (value: T) => void | |
| delete: (value: T) => void | |
| toggle: (value: T) => void | |
| clear: () => void | |
| } |
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 { MapSet } from './map-set'; | |
| describe('MapSet', () => { | |
| it('creates an empty map of sets', () => { | |
| const map = new MapSet<string, number>(); | |
| expect(map.get('a')).toBeUndefined(); | |
| }); | |
| it('adds values to a map of sets', () => { |
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 { act, renderHook } from '@testing-library/react' | |
| import { useList } from './use-list' | |
| describe('useList', () => { | |
| it('creates an empty list', () => { | |
| const { result } = renderHook(() => useList()) | |
| expect(result.current[0]).toEqual([]) | |
| }) |
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 { Mock } from 'vitest'; | |
| import { Emitter } from './emitter'; | |
| enum TestEvent { | |
| move = 'move', | |
| jump = 'jump', | |
| } | |
| type TestEventsMap = { |
NewerOlder