Skip to content

Instantly share code, notes, and snippets.

View vjau's full-sized avatar

Vincent Jaubert vjau

View GitHub Profile
@t3dotgg
t3dotgg / try-catch.ts
Last active April 9, 2025 13:40
Theo's preferred way of handling try/catch in TypeScript
// Types for the result object with discriminated union
type Success<T> = {
data: T;
error: null;
};
type Failure<E> = {
data: null;
error: E;
};
@vjau
vjau / isExactOptional.ts
Created September 16, 2023 13:01
Utility Typescript Type to know when exactOptionalPropertyTypes is set
type _Intersect = {a?:number} & {a:number|undefined};
//state of exactOptionalPropertyTypes
type IsExactOptional = _Intersect["a"] extends Exclude<_Intersect["a"], undefined> ? true : false;
@ammuench
ammuench / 8BitDoUltimateWifi_Linux.MD
Last active April 8, 2025 08:29
8BitDo Ultimate 2.4GHz wifi working in linux
@milankorsos
milankorsos / redux-actions.ts
Last active January 10, 2025 19:22
Correct TypeScript typing example for Redux Thunk actions
import {Action, ActionCreator, Dispatch} from 'redux';
import {ThunkAction} from 'redux-thunk';
// Redux action
const reduxAction: ActionCreator<Action> = (text: string) => {
return {
type: SET_TEXT,
text
};
};
@ericelliott
ericelliott / essential-javascript-links.md
Last active March 22, 2025 17:28
Essential JavaScript Links
@staltz
staltz / introrx.md
Last active April 8, 2025 04:41
The introduction to Reactive Programming you've been missing
@stbaer
stbaer / tinytest.api
Last active November 15, 2016 19:10
Meteor tinytest api
test.isFalse(v, msg)
test.isTrue(v, msg)
test.equal(actual, expected, message, not)
test.length(obj, len)
test.include(s, v)
test.isNaN(v, msg)
test.isUndefined(v, msg)
test.isNotNull
test.isNull
test.throws(func)