Skip to content

Commit b1ef063

Browse files
author
Micah Zoltu
committed
Adds TypeScript definition for the package's supported public surface area.
Note: While this function takes and returns a string, the string is really JSON with a very specific and well defined structure. A future PR will (hopefully) add the definitions for those JSON objects. This PR is meant to be an agreable starting point for getting TypeScript definitions included.
1 parent eace963 commit b1ef063

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

index.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare module 'solc' {
2+
export type ReadCallbackResult = { contents: string } | { error: string }
3+
export type ReadCallback = (path: string) => ReadCallbackResult
4+
export function compile(input: string, readCallback?: ReadCallback): string;
5+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.5.0",
44
"description": "Solidity compiler",
55
"main": "index.js",
6+
"types": "index.d.ts",
67
"bin": {
78
"solcjs": "solcjs"
89
},

0 commit comments

Comments
 (0)