-
Notifications
You must be signed in to change notification settings - Fork 3
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 #2 from yszk0123/add-typescript-declaration-file
Add typescript declaration file
- Loading branch information
Showing
6 changed files
with
63 additions
and
1 deletion.
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,13 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const { expect } = require('chai'); | ||
const { checkDirectory } = require('typings-tester'); | ||
|
||
const ExtensibleCustomError = require('../src'); | ||
|
||
describe('TypeScript definitions', function() { | ||
it('should compile against index.d.ts', function() { | ||
checkDirectory(path.join(__dirname, 'typescript')); | ||
}); | ||
}); |
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,15 @@ | ||
import ExtensibleCustomError from 'extensible-custom-error'; | ||
|
||
new ExtensibleCustomError(); | ||
|
||
new ExtensibleCustomError('message'); | ||
|
||
new ExtensibleCustomError(new Error()); | ||
|
||
new ExtensibleCustomError('message', new Error()); | ||
|
||
// typings:expect-error | ||
new ExtensibleCustomError(Error); | ||
|
||
// typings:expect-error | ||
new ExtensibleCustomError(new Error(), 'message'); |
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,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"lib": ["es2015"], | ||
"strict": true, | ||
"baseUrl": "../..", | ||
"paths": { | ||
"extensible-custom-error": ["types/index.d.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default class ExtensibleCustomError extends Error { | ||
constructor(message?: string, error?: Error); | ||
constructor(error: Error); | ||
} |
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