Skip to content

Instantly share code, notes, and snippets.

View dwjohnston's full-sized avatar
👋

David Johnston dwjohnston

👋
View GitHub Profile
@dwjohnston
dwjohnston / MockedService.ts
Created June 27, 2024 00:41
attempt at a MockedService utility type
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-explicit-any */
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
type IsAny<T, Y, N> = IfAny<T, Y, N>;
type TypeWithGeneric<T> = T[];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// type extractGeneric<Type> =
// Type extends jest.MaybeMockedDeep<infer X, any[], any> ? X : never;
@dwjohnston
dwjohnston / hexToCssFilters.ts
Last active March 18, 2024 16:07
TS Hex to CSS filters solution
//As referenced in this solution
import { number } from "prop-types";
//https://codepen.io/sosuke/pen/Pjoqqp
interface HSL {
h: number;