This repository has been archived by the owner on Sep 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flow type definitions which would improve workflow for dependent libraries that happen to use flow type-checker.
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 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,11 @@ | ||
[ignore] | ||
|
||
[include] | ||
|
||
[libs] | ||
|
||
[lints] | ||
|
||
[options] | ||
|
||
[strict] |
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,32 @@ | ||
// @flow strict | ||
|
||
export type Version = 0 | 1 | ||
export type Codec = string | ||
export type Multihash = Buffer | ||
export type BaseEncodedString = string | ||
|
||
declare class CID<a> { | ||
constructor(Version, Codec, Multihash): void; | ||
constructor(BaseEncodedString): void; | ||
constructor(Buffer): void; | ||
|
||
+codec: Codec; | ||
+multihash: Multihash; | ||
+buffer: Buffer; | ||
+prefix: Buffer; | ||
|
||
toV0(): CID<a>; | ||
toV1(): CID<a>; | ||
toBaseEncodedString(base?: string): BaseEncodedString; | ||
toString(): BaseEncodedString; | ||
toJSON(): { codec: Codec, version: Version, hash: Multihash }; | ||
|
||
equals(mixed): boolean; | ||
|
||
static codecs: { [string]: Codec }; | ||
static isCID(mixed): boolean; | ||
static validateCID(mixed): void; | ||
} | ||
|
||
export default CID | ||
export type { CID } |