View Maybe.ts
export type something = string | number | boolean | symbol | object;
export type Maybe<T extends something> = Some<T> | None;
export type None = { v: undefined, error?: string };
export type Some<T extends something> = { v: T };
export function maybe<T extends something>(v: T | undefined, error?: string): Maybe<T> {
if (typeof v === "undefined") {
let n: None = {v: undefined};
if (error) {

ItemType Generic Utility Type

This is to describe the situation where one might want to use the type of an array indirectly.

The ItemType generic is sugar over an existing capability in TypeScript to access the type information of the Array generic and make accessing that type more legible to the reader. But a few people replied with "huh, I don't think you want to do that", and to their point, I agree... mostly.

It's almost always better to declare a variable to be of the Array's type directly.

View SubsetTree.ts
import { Queue } from "typescript-collections";
const subsetFunctions = new WeakMap<SubsetTree<any>, IsSubsetFunction<any>>();
const subsetMemos = new WeakMap<IsSubsetFunction<any>, WeakMap<any, WeakMap<any, boolean>>>();
* A subset tree self organizes new nodes such that they will be added to place
* in the tree where it is guaranteed that all nodes in the tree that have
* values that are subsets of the value in the new node are descendants of that
View IdentityDictionary.ts
import {
} from "typescript-collections";
* This data structure is effectively a Set but it is optimized for
* retrieving the instance associated with the set's identity key.
* If an instance implements this interface, the function will be used to
* create it's key value by the default implementation. Otherwise a custom

An example of a simple form

Consider the following markup:

<form class="root" state:theme=dark state:compact>
  <div class="input-area">
    <label for="username" class="label">Username:</label>
    <input id="username" class="input" type="text">
View ChromeUserAgent.css
@namespace "";
html {
display: block;
head {
display: none;
View Cascade.ts
import * as parse5 from "parse5";
import * as postcss from "postcss";
import * as CSSselect from "css-select";
import * as specificity from "specificity";
import * as propParser from "css-property-parser";
type Document = parse5.AST.HtmlParser2.Document;
type Node = parse5.AST.HtmlParser2.Node;
type ParentNode = parse5.AST.HtmlParser2.ParentNode;
type HtmlElement = parse5.AST.HtmlParser2.Element;
View typedAssert.ts
import { assert } from "chai";
export function isDefined<X>(value: X | undefined): {and: (cb: (defValue: X) => any) => void } {
if (value) {
return {
and: function(cb: (v: X) => void) {
} else {
View css-terms.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View syntax_ambiguity.scss
{ color: red; }
color: blue