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 #195 from Level/typescript
Add and fix TypeScript tests
- Loading branch information
Showing
11 changed files
with
220 additions
and
314 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
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
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,7 @@ | ||
// This file is required for the use of process.browser, which is | ||
// not defined in @types/node but a property added by browserify. | ||
declare namespace NodeJS { | ||
interface Process { | ||
browser: boolean; | ||
} | ||
} |
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
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 @@ | ||
import { AbstractLevelDOWN } from '.' | ||
|
||
const buf = Buffer.from('foo') | ||
|
||
// Key and value generics | ||
new AbstractLevelDOWN<string, string>('loc').put('key', 'value', (err: Error) => {}) | ||
new AbstractLevelDOWN<Buffer, Buffer>('loc').put(buf, buf, (err: Error) => {}) | ||
new AbstractLevelDOWN<number, object>('loc').put(1, {}, (err: Error) => {}) | ||
|
||
new AbstractLevelDOWN<string, string>('loc').get('key', (err: Error, value: string) => {}) | ||
new AbstractLevelDOWN<Buffer, Buffer>('loc').get(buf, (err: Error, value: Buffer) => {}) | ||
new AbstractLevelDOWN<number, object>('loc').get(1, (err: Error, value: object) => {}) | ||
|
||
// The generics default to "any" | ||
new AbstractLevelDOWN('loc').put(1, {}, (err: Error) => {}) | ||
new AbstractLevelDOWN('loc').put('key', 'value', (err: Error) => {}) | ||
new AbstractLevelDOWN('loc').put(buf, false, (err: Error) => {}) | ||
|
||
new AbstractLevelDOWN('loc').get(1, (err: Error, value: any) => {}) | ||
new AbstractLevelDOWN('loc').get('key', (err: Error, value: any) => {}) | ||
new AbstractLevelDOWN('loc').get(buf, (err: Error, value: any) => {}) |
Oops, something went wrong.