Skip to content

Commit

Permalink
fix: Separate ESM/CJS TS definitions (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
russellsteadman committed Apr 15, 2023
1 parent 3cea40d commit 453de51
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 39 deletions.
17 changes: 14 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ declare class Long {
/**
* Returns a Long representation of the given string, written using the specified radix.
*/
static fromString(str: string, unsigned?: boolean | number, radix?: number): Long;
static fromString(
str: string,
unsigned?: boolean | number,
radix?: number
): Long;

/**
* Creates a Long from its byte representation.
Expand All @@ -102,7 +106,14 @@ declare class Long {
/**
* Converts the specified value to a Long.
*/
static fromValue(val: Long | number | string | { low: number, high: number, unsigned: boolean }, unsigned?: boolean): Long;
static fromValue(
val:
| Long
| number
| string
| { low: number; high: number; unsigned: boolean },
unsigned?: boolean
): Long;

/**
* Returns the sum of this and the specified Long.
Expand Down Expand Up @@ -443,4 +454,4 @@ declare class Long {
xor(other: Long | number | string): Long;
}

export = Long; // compatible with `import Long from "long"`
export default Long; // compatible with `import Long from "long"`
44 changes: 13 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@
"license": "Apache-2.0",
"type": "module",
"main": "umd/index.js",
"types": "index.d.ts",
"types": "umd/index.d.ts",
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js",
"require": "./umd/index.js"
"import": {
"default": "./index.js",
"types": "./index.d.ts"
},
"require": {
"default": "./umd/index.js",
"types": "./umd/index.d.ts"
}
}
},
"scripts": {
Expand All @@ -40,6 +45,6 @@
"README.md"
],
"devDependencies": {
"esm2umd": "^0.2.0"
"esm2umd": "^0.2.1"
}
}

0 comments on commit 453de51

Please sign in to comment.