Skip to content

Commit

Permalink
Add example typing for "Function Module" pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongsp committed Jan 20, 2016
1 parent 0144aea commit 47fb441
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions doc/handbook/Writing Definition Files.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,25 @@ declare var Eagle: Eagle;
export = Eagle;
```

## Module as a Function

#### Usage

```ts
// Common pattern for node modules (e.g. rimraf, debug, request, etc.)
import sayHello = require('say-hello');
sayHello('Travis');
```

#### Typing

```ts
declare module 'say-hello' {
function sayHello(name: string): void;
export = sayHello;
}
```

## 回调函数

#### 应用示例
Expand Down

0 comments on commit 47fb441

Please sign in to comment.