Skip to content

Commit 453de51

Browse files
fix: Separate ESM/CJS TS definitions (#121)
1 parent 3cea40d commit 453de51

File tree

3 files changed

+37
-39
lines changed

3 files changed

+37
-39
lines changed

index.d.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ declare class Long {
7777
/**
7878
* Returns a Long representation of the given string, written using the specified radix.
7979
*/
80-
static fromString(str: string, unsigned?: boolean | number, radix?: number): Long;
80+
static fromString(
81+
str: string,
82+
unsigned?: boolean | number,
83+
radix?: number
84+
): Long;
8185

8286
/**
8387
* Creates a Long from its byte representation.
@@ -102,7 +106,14 @@ declare class Long {
102106
/**
103107
* Converts the specified value to a Long.
104108
*/
105-
static fromValue(val: Long | number | string | { low: number, high: number, unsigned: boolean }, unsigned?: boolean): Long;
109+
static fromValue(
110+
val:
111+
| Long
112+
| number
113+
| string
114+
| { low: number; high: number; unsigned: boolean },
115+
unsigned?: boolean
116+
): Long;
106117

107118
/**
108119
* Returns the sum of this and the specified Long.
@@ -443,4 +454,4 @@ declare class Long {
443454
xor(other: Long | number | string): Long;
444455
}
445456

446-
export = Long; // compatible with `import Long from "long"`
457+
export default Long; // compatible with `import Long from "long"`

package-lock.json

Lines changed: 13 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@
1818
"license": "Apache-2.0",
1919
"type": "module",
2020
"main": "umd/index.js",
21-
"types": "index.d.ts",
21+
"types": "umd/index.d.ts",
2222
"exports": {
2323
".": {
24-
"types": "./index.d.ts",
25-
"import": "./index.js",
26-
"require": "./umd/index.js"
24+
"import": {
25+
"default": "./index.js",
26+
"types": "./index.d.ts"
27+
},
28+
"require": {
29+
"default": "./umd/index.js",
30+
"types": "./umd/index.d.ts"
31+
}
2732
}
2833
},
2934
"scripts": {
@@ -40,6 +45,6 @@
4045
"README.md"
4146
],
4247
"devDependencies": {
43-
"esm2umd": "^0.2.0"
48+
"esm2umd": "^0.2.1"
4449
}
4550
}

0 commit comments

Comments
 (0)