-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from pahen/typescript
Support for TypeScript
- Loading branch information
Showing
6 changed files
with
65 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
; http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[{package.json,.travis.yml}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* eslint-env mocha */ | ||
'use strict'; | ||
|
||
const madge = require('../lib/api'); | ||
require('should'); | ||
|
||
describe('TypeScript', () => { | ||
const dir = __dirname + '/typescript'; | ||
|
||
it('extracts module dependencies', (done) => { | ||
madge(dir + '/import.ts').then((res) => { | ||
res.obj().should.eql({ | ||
'import.ts': ['require.ts'], | ||
'require.ts': ['export.ts'], | ||
'export.ts': [] | ||
}); | ||
done(); | ||
}).catch(done); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class ExportClass { | ||
stringLength(s: string) { | ||
return s.length; | ||
} | ||
} | ||
|
||
export = ExportClass; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import B from './require'; | ||
|
||
class ImportClass { | ||
constructor(public greeting: string) { } | ||
greet() { | ||
return "<h1>" + this.greeting + "</h1>"; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import x = require('./export'); | ||
|
||
export default class RequireClass { | ||
stringLength(s: string) { | ||
return s.length; | ||
} | ||
} |