Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scrolloop",
"version": "0.5.1",
"version": "0.5.2",
"repository": {
"type": "git",
"url": "git+https://github.com/976520/scrolloop.git"
Expand Down Expand Up @@ -98,9 +98,5 @@
"vitepress": "^1.6.4",
"vitest": "^2.0.0",
"vue": "^3.5.26"
},
"dependencies": {
"@scrolloop/core": "workspace:*",
"@scrolloop/shared": "workspace:*"
}
}
12 changes: 10 additions & 2 deletions packages/react-native/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import type { ReactNode } from "react";
import type { ViewStyle, ScrollViewProps } from "react-native";
import type { PageResponse, Range } from "@scrolloop/shared";

export type { PageResponse, Range };
export interface Range {
startIndex: number;
endIndex: number;
}

export interface PageResponse<T> {
items: T[];
total: number;
hasMore: boolean;
}
Comment on lines +4 to +13
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

As with the React package, this duplication is a potential source of bugs if the shared types are updated but these local copies are forgotten. Relying on build-time inlining of types is a safer long-term approach for maintaining a DRY codebase.


export interface ItemProps {
key: number | string;
Expand Down
3 changes: 2 additions & 1 deletion packages/react-native/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export default defineConfig({
},
},
target: "es2020",
external: ["react", "react-native", "@scrolloop/core", "@scrolloop/shared"],
external: ["react", "react-native"],
noExternal: ["@scrolloop/core", "@scrolloop/shared"],
outExtension({ format }) {
return {
js: format === "esm" ? ".mjs" : ".cjs",
Expand Down
12 changes: 10 additions & 2 deletions packages/react/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import type { CSSProperties, ReactNode, HTMLAttributes } from "react";
import type { PageResponse, Range } from "@scrolloop/shared";

export type { PageResponse, Range };
export interface Range {
startIndex: number;
endIndex: number;
}

export interface PageResponse<T> {
items: T[];
total: number;
hasMore: boolean;
}
Comment on lines +3 to +12
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Defining these interfaces locally instead of importing them from @scrolloop/shared introduces a maintenance risk where the definitions might diverge over time. If the tsup configuration can be adjusted to reliably inline these types into the .d.ts file (using explicit dts.resolve), it would be preferable to keep the single source of truth in the shared package.


export type TransitionState =
| { type: "SSR_DOM" }
Expand Down
3 changes: 2 additions & 1 deletion packages/react/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export default defineConfig({
},
},
target: "es2020",
external: ["react", "react-dom", "@scrolloop/core", "@scrolloop/shared"],
external: ["react", "react-dom"],
noExternal: ["@scrolloop/core", "@scrolloop/shared"],
outExtension({ format }) {
return {
js: format === "esm" ? ".mjs" : ".cjs",
Expand Down
7 changes: 0 additions & 7 deletions pnpm-lock.yaml

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

Loading