Skip to content

feat(types): Add missing type definition for diff function#3520

Merged
josdejong merged 5 commits into
josdejong:developfrom
dodokw:develop
Sep 2, 2025
Merged

feat(types): Add missing type definition for diff function#3520
josdejong merged 5 commits into
josdejong:developfrom
dodokw:develop

Conversation

@dodokw
Copy link
Copy Markdown
Contributor

@dodokw dodokw commented Aug 20, 2025

This PR addresses an issue where the diff function, which exists in the JavaScript implementation, is missing from the TypeScript type definitions (index.d.ts). This omission causes a type error in TypeScript projects when trying to use math.diff(), even though the function works correctly at runtime.

@dodokw
Copy link
Copy Markdown
Contributor Author

dodokw commented Aug 27, 2025

@josdejong can u please review this pr?

@josdejong
Copy link
Copy Markdown
Owner

Thanks @dodokw !

Two remarks:

  1. The function can be used in two ways: diff(arr) and diff(arr, dim). Can you add type definitions for diff(arr, dim)?
  2. Can you add a couple of tests to test/typescript-tests/testTypes.ts to guard that the definitions of diff indeed work?

@dodokw
Copy link
Copy Markdown
Contributor Author

dodokw commented Aug 31, 2025

@josdejong
Thanks for the review. I've addressed both of your remarks and have added the type definitions for diff(arr, dim) as well as a couple of tests to test/typescript-tests/testTypes.ts

@josdejong
Copy link
Copy Markdown
Owner

Thanks for the update @dodokw, this looks good!

Last thing: can you undo the formatting changes in tsconfig.json?

@dodokw
Copy link
Copy Markdown
Contributor Author

dodokw commented Sep 2, 2025

@josdejong
sure! thanks for the review!

@josdejong josdejong merged commit df8d098 into josdejong:develop Sep 2, 2025
8 checks passed
@josdejong
Copy link
Copy Markdown
Owner

👌 thank you!

@josdejong
Copy link
Copy Markdown
Owner

Fixed now in v14.7.0, thaks again Dong Kwan Kho.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants