Skip to content

Instantly share code, notes, and snippets.

Homa Wong unional

Block or report user

Report or block unional

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
git branch -vv | grep ': gone]' | awk '{print $1}' | xargs git branch -D
unional / package.json
Created Jan 27, 2018
Make semantic-release to release breaking as minor
View package.json
"release": {
"analyzeCommits": {
"releaseRules": [
"breaking": true,
"release": "minor"
#! /bin/bash
# Thanks to Night Train:
# To use this, create this file (e.g. under scripts folder: ./scripts/
# and give it execution permission: chmod ugo+x scripts/
# Then you can use it in CI configurations, e.g. .travis.yml:
# - ./scripts/ latest "npm install --no-save coveralls && npm run coveralls"
unional / .travis.yml
Created Nov 20, 2017
Better travis strategy
View .travis.yml
- master
- /^greenkeeper.*$/
# vs
- /^v\d+\.\d+\.\d+$/
unional / event-error.js
Last active Nov 17, 2017
Error thrown in event listener affects emit code
View event-error.js
const EventEmitter = require('events')
const emitter = new Eventemitter()
function shouldNotThrow() {
try {
catch {
// unfortunately, error is thrown

How to write typings

When you write typed definitions for DefinitelyTyped, you create a pull request on DefinitelyTyped with the corresponding .d.ts file and you are done. In the .d.ts file you write either an ambient internal module or ambient external module as in the handbook.

Things are a little bit different when you write a typings.

While it is definitely not harder then writing typed definitions for DefinitelyTyped, there isn't a clear term or reference on how to write a typings.

First things first...terminology

Going through the handbook and spec to understand everything you need to write typings is a great thing to do, but it isn't fun. Also, since TypeScript is rapidly improving, some information in the handbook is out of date.

unional / typings.install.ts
Created Feb 4, 2016
typings.install() API proposal
View typings.install.ts
export interface InstallOptions {
cwd: string;
* If not specified, will benerate both "browser.d.ts" and "main.d.ts"
env?: "browser" | "main" | string[];
production: boolean; // Q: Not sure if this should be part of public API
export interface Typings {
unional / typings.init.ts
Created Feb 4, 2016
typings.init() API proposal
View typings.init.ts
export interface InitOptions {
cwd: string;
upgrade?: boolean;
export interface typings {
init(options: InitOptions): void
unional / typings.js
Created Feb 2, 2016
Temp fix for using typings/tsd in jspm module: system environment
View typings.js
// Run this after you update your typings.
const gulp = require('gulp');
const replace = require('gulp-replace');
gulp.task('es6-typings', () => {
var srcPath = 'typings/browser/**/*'; // or 'typings/main/**/*' or 'typings/**/*' if you use `tsd`
gulp.src(srcPath, { base: './' })
.pipe(replace('export =', 'export default'))
You can’t perform that action at this time.