Skip to content

Commit 2183d94

Browse files
authored
fix: updating exports property so that it works properly and adding migration guide to v1 (#109)
1 parent d1bb223 commit 2183d94

File tree

4 files changed

+46
-7
lines changed

4 files changed

+46
-7
lines changed

MIGRATION.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# TypeScript Types Migration
2+
3+
## Important: Remove Community `@types` Package
4+
5+
Starting from version 1.0.0, `react-scroll-sync` provides its own TypeScript type definitions built-in.
6+
**You must uninstall the community `@types/react-scroll-sync` package to avoid type conflicts and ensure you are using the latest, official types.**
7+
8+
### Migration Steps
9+
10+
1. **Uninstall the community types:**
11+
12+
```sh
13+
npm uninstall @types/react-scroll-sync
14+
# or, if you use yarn:
15+
yarn remove @types/react-scroll-sync
16+
```
17+
18+
2. **Update your imports (if needed):**
19+
20+
You can now use `react-scroll-sync` directly in your TypeScript code without any additional type packages.
21+
22+
```ts
23+
import { ScrollSync, ScrollSyncPane } from "react-scroll-sync";
24+
```
25+
26+
3. **Check your code:**
27+
28+
The official types are included automatically. If you encounter any type errors, ensure the old `@types/react-scroll-sync` package is fully removed from your `node_modules` and `package.json`.
29+
30+
---

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ https://react-sync-scroll.netlify.app/
1010

1111
https://react-sync-scroll.netlify.app/
1212

13+
## Migration from v0 to v1
14+
15+
If you are upgrading from `react-scroll-sync` v0 to v1, please review the [Migration Guide](./MIGRATION.md).
16+
Version 1.0.0 and above provide built-in TypeScript type definitions, so you **must uninstall the community `@types/react-scroll-sync` package** to avoid type conflicts. The guide includes all required steps to ensure a smooth upgrade.
17+
1318
## License
1419

1520
MIT

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
"module": "./dist/index.mjs",
99
"exports": {
1010
".": {
11-
"types": "./dist/index.d.ts",
12-
"module": "./dist/index.mjs",
13-
"main": "./dist/index.cjs",
14-
"umd": "./dist/index.js"
11+
"import": {
12+
"types": "./dist/index.d.ts",
13+
"default": "./dist/index.mjs"
14+
},
15+
"require": {
16+
"types": "./dist/index.d.cts",
17+
"default": "./dist/index.cjs"
18+
}
1519
}
1620
},
1721
"files": [

tsup.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { defineConfig } from "tsup";
1+
import { defineConfig } from 'tsup';
22

33
export default defineConfig({
44
clean: true,
55
dts: true,
6-
entry: ["src/index.ts"],
7-
format: ["cjs", "esm", "iife"],
6+
entry: ['src/index.ts'],
7+
format: ['cjs', 'esm'],
88
sourcemap: true,
99
});

0 commit comments

Comments
 (0)