Skip to content

Commit

Permalink
TIL about tsc -d. No need for manually-curated interface files.
Browse files Browse the repository at this point in the history
  • Loading branch information
John Vilk committed Dec 19, 2013
1 parent f114942 commit 308b3ae
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
14 changes: 0 additions & 14 deletions interface/node-ar.d.ts

This file was deleted.

16 changes: 15 additions & 1 deletion node-ar.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
/// <reference path="bower_components/DefinitelyTyped/node/node.d.ts" />
/// <reference path="interface/node-ar.d.ts" />
import fs = require('fs');
import path = require('path');

/**
* Contains information from a file's header.
*/
export interface ARFile {
name(): string;
date(): Date;
uid(): number;
gid(): number;
mode(): number;
fileSize(): number;
headerSize(): number;
totalSize(): number;
fileData(): NodeBuffer;
}

export class Archive {
private files: ARFile[] = [];
constructor(private data: NodeBuffer) {
Expand Down
7 changes: 3 additions & 4 deletions tests/runner.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference path="../bower_components/DefinitelyTyped/node/node.d.ts" />
/// <reference path="../interface/node-ar.d.ts" />
/**
* node-ar test runner command line utility
*
Expand Down Expand Up @@ -49,7 +48,7 @@ class Test {
/**
* Compares the ar file against the real file on the hard drive.
*/
private testFile(arFile: ARFile, filePath: string) {
private testFile(arFile: ar.ARFile, filePath: string) {
var realFileContents: NodeBuffer = fs.readFileSync(filePath),
arFileContents: NodeBuffer = arFile.fileData(), i: number;
if (realFileContents.length !== arFileContents.length) {
Expand All @@ -74,8 +73,8 @@ class Test {
*/
private testFiles() {
var files: string[] = fs.readdirSync(this.dirPath),
arFiles: ARFile[] = this.archive.getFiles(),
i: number, file: ARFile, name: string, nameIdx: number;
arFiles: ar.ARFile[] = this.archive.getFiles(),
i: number, file: ar.ARFile, name: string, nameIdx: number;
for (i = 0; i < arFiles.length; i++) {
file = arFiles[i];
name = file.name();
Expand Down

0 comments on commit 308b3ae

Please sign in to comment.