-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split options.name into options.name and options.prefix, and prefix n…
…on-relative imports with options.prefix (#94) * Prefix absolute imports with options.name * Validate main input instead of changing the main generation logic * Improve validation logic and comments * Improve testing * comments and cleanup * Refactor to match spec we've agreed on in discussion on #94 - split name and prefix, no autoprefixing for resolve* function results; no prefixing for external modules (.d.ts inputs). * Fix tabs vs. spaces. Make error message clearer about dts-generator vs. typescript versions. * fix more tabs v spaces * absolute -> non-relative. Also kill a stale TODO
- Loading branch information
1 parent
25eeead
commit c9987cc
Showing
8 changed files
with
186 additions
and
30 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
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 @@ | ||
export default class Bar { | ||
private bar: string; | ||
constructor () { | ||
this.bar = 'bar'; | ||
} | ||
foo: number; | ||
qat: { foo?: string; } = {}; | ||
} |
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,21 @@ | ||
/** | ||
* Some JSDoc for you! | ||
* @param baz Something | ||
*/ | ||
export function baz() { | ||
console.log('baz'); | ||
return 'baz'; | ||
} | ||
|
||
/** | ||
* JSDOC Type Annotation | ||
*/ | ||
export type Foo = { bar: string } & { qat: number }; | ||
|
||
/** | ||
* Some more JSDOC | ||
* @param something Blah blah blah | ||
*/ | ||
export function qat(something: Foo) { | ||
return something; | ||
} |
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 @@ | ||
/// <reference path="./somejs.d.ts" /> | ||
|
||
import Bar from 'sub/Bar'; | ||
|
||
import { baz as fooBaz, qat as fooQat, Foo as BazFoo } from 'sub/baz'; | ||
import somejs = require('sub/somejs'); | ||
|
||
export default class Foo { | ||
private foo: BazFoo; | ||
bar: Bar; | ||
baz = fooBaz; | ||
qat = fooQat; | ||
constructor (foo: BazFoo) { | ||
this.bar = new Bar(); | ||
this.foo = foo; | ||
} | ||
} | ||
|
||
export const foo = new Foo({ bar: '', qat: 1 }); | ||
export const js = somejs.js; |
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 @@ | ||
|
||
interface RubeGoldbergMachine { | ||
pieces: string[]; | ||
stages: any[]; | ||
start: Function; | ||
} | ||
|
||
declare module 'sub/somejs' { | ||
let exports: { | ||
js: RubeGoldbergMachine | ||
}; | ||
export = exports; | ||
} |
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,16 @@ | ||
{ | ||
"version": "1.6.2", | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "umd", | ||
"jsx": "react", | ||
"rootDir": ".", | ||
"declaration": false, | ||
"noImplicitAny": true | ||
}, | ||
"files": [ | ||
"./sub/index.ts", | ||
"./sub/baz.ts", | ||
"./sub/Bar.ts" | ||
] | ||
} |
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