Add typescript definition (#545)

This commit is contained in:
Todd Kennedy
2017-10-05 16:51:09 -04:00
committed by GitHub
parent 2e4c76eca8
commit 8615c9b481
2 changed files with 39 additions and 0 deletions
Vendored
+38
View File
@@ -0,0 +1,38 @@
/// <reference types="node" />
import * as EventEmitter from 'events'
export = Choo
declare class Choo {
constructor (opts: Choo.IChoo)
use (callback: (state: Choo.IState, emitter: EventEmitter) => void): void
route (routeName: string, handler: (state: Choo.IState, emit: (name: string, ...args: any[]) => void) => void): void
mount (selector: string): void
start (): HTMLElement
toString (location: string, state?: Choo.IState): string
}
declare namespace Choo {
export interface IChoo {
history?: boolean
href?: boolean
}
export interface IState {
events: {
[key: string]: string
}
params: {
[key: string]: string
}
query?: {
[key: string]: string
}
href: string
route: string
title: string
[key: string]: any
}
}
+1
View File
@@ -43,6 +43,7 @@
"xtend": "^4.0.1"
},
"devDependencies": {
"@types/node": "^8.0.20",
"browserify": "^14.3.0",
"bundle-collapser": "^1.2.1",
"dependency-check": "^2.8.0",