-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Suggestion: a built-in TypedArray interface #15402
Copy link
Copy link
Open
Labels
Domain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueHelp WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Metadata
Metadata
Assignees
Labels
Domain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueHelp WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript
I would have expected a
TypedArrayinterface to exist inthe built-in declaration libraries. Instead, there are independent types for
Int8Array, etc, with no common base type.It seems sensible that there should be a common
TypedArraytype, both becauseTypedArray, andIs there a good reason why there is no
TypedArraytype? If not, I can submit a PR.Use case
Consider the
isTypedArray()function from lodash.Currently, it is declared as follows:
This proposal would enable an appropriate type-guard, without declaring
a convoluted union type: