Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC]: improve type declarations for @stdlib/ndarray/array #1088

Open
3 tasks done
kgryte opened this issue Aug 22, 2023 · 7 comments · May be fixed by #1392
Open
3 tasks done

[RFC]: improve type declarations for @stdlib/ndarray/array #1088

kgryte opened this issue Aug 22, 2023 · 7 comments · May be fixed by #1392
Assignees
Labels
Accepted RFC feature request which has been accepted. difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. Enhancement Issue or pull request for enhancing existing functionality. priority: High High priority concern or feature request. RFC Request for comments. Feature requests and proposed changes. TypeScript Issue involves or relates to TypeScript.

Comments

@kgryte
Copy link
Member

kgryte commented Aug 22, 2023

Description

This RFC proposes improving the TypeScript type declarations for @stdlib/ndarray/array. Currently, type declarations do not account for dtype information.

Ideally, we'd improve declarations such that

  • based on a provided dtype option value, we return an ndarray of the corresponding type (e.g., if dtype = 'float64', then return a float64ndarray, etc).
  • when not provided a dtype option value, we use the buffer argument/option to infer a corresponding output ndarray dtype.

Supporting the above is likely to require extensive use of function overloads in a manner to what we've done elsewhere in the project when a dtype can effect output results.

Related Issues

No.

Questions

No.

Other

No.

Checklist

  • I have read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
  • The issue name begins with RFC:.
@kgryte kgryte added Enhancement Issue or pull request for enhancing existing functionality. RFC Request for comments. Feature requests and proposed changes. TypeScript Issue involves or relates to TypeScript. labels Aug 22, 2023
@itsspriyansh

This comment was marked as outdated.

@BhaveshP443

This comment was marked as outdated.

@kgryte kgryte added Accepted RFC feature request which has been accepted. priority: High High priority concern or feature request. difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. labels Feb 23, 2024
@prajwalkulkarni
Copy link
Contributor

I'd like to pick this up!

@prajwalkulkarni
Copy link
Contributor

Since the dtype (e.g: float64, int32 etc) are subsets of a primitive type number, wouldn't TS coerce these types back to number? Could you kindly give more information about the return type here?

@kgryte
Copy link
Member Author

kgryte commented Mar 25, 2024

The dtype concerns the dtype of the ndarray. They do not correspond to number primitives.

@kgryte
Copy link
Member Author

kgryte commented Mar 25, 2024

I suggest consulting the type definitions in @stdlib/types.

@G4URAV001
Copy link
Contributor

@kgryte can I pick this issue as its been along time since it was last assigned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted RFC feature request which has been accepted. difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. Enhancement Issue or pull request for enhancing existing functionality. priority: High High priority concern or feature request. RFC Request for comments. Feature requests and proposed changes. TypeScript Issue involves or relates to TypeScript.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants