Skip to content

Instantly share code, notes, and snippets.

View cartant's full-sized avatar

Nicholas Jamieson cartant

View GitHub Profile
type Inputs<Elements> = {
[Key in keyof Elements]: readonly Elements[Key][];
};
declare function combine<Elements extends unknown[]>(
...inputs: [...Inputs<Elements>]
): Elements[number][];
const result = combine(["a", "b"], [1, 2]);
Exported variable 'read' has or is using private name 'ReadCallback'.
const read = (() => {
interface ReadCallback {
(content: string): string;
}
return function (path: string, callback: ReadCallback) {};
})();
declare const read: (
path: string,
callback: (content: string) => string
) => void;
const read = (() => {
type ReadCallback = (content: string) => string;
return function (path: string, callback: ReadCallback) {};
})();
declare type ReadCallback = (content: string) => string;
declare function read(path: string, callback: ReadCallback): void;
type ReadCallback = (content: string) => string;
function read(path: string, callback: ReadCallback) {}
import { config } from "rxjs";
config.onStoppedNotification = (notification) => {
switch (notification.kind) {
case "E":
const error: any = new Error(
"Cannot notify stopped observer"
);
error.notification = notification;
throw error;
import { concat, NEVER, Observable, OperatorFunction } from "rxjs";
import { buffer, mergeAll, publish, take } from "rxjs/operators";
function delayUntil<T>(notifier: Observable<any>): OperatorFunction<T, T> {
return source =>
source.pipe(
publish(published =>
concat(
concat(published, NEVER).pipe(buffer(notifier), take(1), mergeAll()),
published