Skip to content

Instantly share code, notes, and snippets.

@fbartho
fbartho / hoc-generics-partial-application.tsx
Last active July 26, 2019 17:46 — forked from miloszpp/hoc.ts
Test that demonstrates the new Generic Propagation features available in TypeScript 3.4
import React from "react";
interface InjectedProps {
injected1: string;
}
interface PubProps<Foo> {
pubProp1: Foo;
}
declare function bind<T>(
component: React.ComponentType<T & InjectedProps>,
@fbartho
fbartho / API-Generator Readme.md
Created August 2, 2019 17:50
RFC For a Props Type / Constants / JSDocs Generator for tipsi-stripe

API Generator

This is a little helper module that uses TypeScript to generate the following:

  • props-types checkers for JavaScript -- for import into the appropriate locations
  • jsdocs-style Documentation Comments -- for manual copying into the main API interface
  • String Enums for Android -- for use in extracting objects from the API Bridge
  • String Enums for iOS -- for use in extracting objects from the API Bridge
  • A TypeScript .d.ts file -- Future Feature / .gitignored for now
@fbartho
fbartho / tipsi-stripe.d.ts
Created September 5, 2020 16:05
Typings for tipsi-stripe@8.0.0
/*
* File: /src/types/tipsi-stripe/tipsi-stripe.d.ts
* Project: tr_client
* Created Date: 2019-07-18
*
* Initial Implementation: https://github.com/tipsi/tipsi-stripe/pull/384/files
* Also relevant: https://github.com/tipsi/tipsi-stripe/pull/264
*/
declare module "tipsi-stripe" {
import { Component } from "react";
@fbartho
fbartho / 1. Problem.swift
Last active April 5, 2024 22:38
Swift Structured Concurrency - Actors and Rescheduling
actor Scheduler {
var tasks: [@Sendable () async -> Void]
func schedule(task: @escaping @Sendable () async -> Void) {
tasks.append(task)
}
func executeAll() async {
while let t = tasks.popLast() {
// Tasks may schedule more tasks when they execute
await t()
// How do I defer this loop until any pending schedule operations hit my actor?