Skip to content

Commit

Permalink
fixed a type declaration bug
Browse files Browse the repository at this point in the history
  • Loading branch information
olarsson committed Nov 21, 2023
1 parent 12c1659 commit c51c4b2
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# react-scrollsy v1.1.6 ![](https://img.badgesize.io/olarsson/react-scrollsy/master/dist/react-scrollsy.es.js)
# react-scrollsy v1.1.7 ![](https://img.badgesize.io/olarsson/react-scrollsy/master/dist/react-scrollsy.es.js)

An ambitious light-weight react module written in TypeScript for tracking scroll progress in a performant way. Developed for use with spring based animation libraries such as react-spring, but can be used with or without any library.

Expand Down Expand Up @@ -191,6 +191,9 @@ If it still doesnt work then change the import string in the following fashion:

### Whats new

##### Version 1.1.7
- [x] Fixed a type declaration bug

##### Version 1.1.6
- [x] Improved type declarations
- [x] Minor changes to some examples
Expand Down
4 changes: 3 additions & 1 deletion dist/react-scrollsy.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ const _ = (e, n) => {
children: e
});
}, X = ({ children: e, scrollThrottle: n, scrollingElement: i, resizeThrottle: r }) => {
const [t, o] = p(!1), [s, u] = p(void 0), c = E({
const [t, o] = p(!1), [s, u] = p(void 0);
console.log(i);
const c = E({
scrollData: {
scrollTop: 0,
scrollHeight: 0,
Expand Down
2 changes: 1 addition & 1 deletion dist/react-scrollsy.umd.js

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

4 changes: 2 additions & 2 deletions dist/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ type TScrollObject = {
start: number;
end: number;
};
export type TChildren = ((props: IScrollDataChildren | IScrollObject) => any) | {
export type TChildren = ((props: IScrollDataChildren | IScrollObject) => unknown) | {
children: React.ReactNode;
};
} | unknown;
export interface IScrollDataBase {
scrollTop: number;
scrollHeight: number;
Expand Down
3 changes: 3 additions & 0 deletions src/ScrollTrackerCustom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const ScrollTrackerCustom = ({ children, scrollThrottle, scrollingElement
const [update, setUpdate] = useState<boolean>(false);
const [customHtmlElement, setCustomHtmlElement] = useState<HTMLElement | undefined>(undefined);

console.log(scrollingElement);

const returns = childrenAsMethod({
scrollData: {
scrollTop: 0,
Expand All @@ -19,6 +21,7 @@ export const ScrollTrackerCustom = ({ children, scrollThrottle, scrollingElement
},
children: children,
});


waitForElm(scrollingElement).then((elem) => {
if (!customHtmlElement) {
Expand Down
2 changes: 0 additions & 2 deletions src/ScrollTrackerDocument.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import { describe, test, expect } from "vitest";
import { render } from "@testing-library/react";

Expand Down
5 changes: 2 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ type TScrollObject = {
end: number;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type TChildren = ((props: IScrollDataChildren | IScrollObject) => any)
export type TChildren = ((props: IScrollDataChildren | IScrollObject) => unknown)
| {
children: React.ReactNode
}
} | unknown

export interface IScrollDataBase {
scrollTop: number;
Expand Down

0 comments on commit c51c4b2

Please sign in to comment.