About 50 results
Open links in new tab
  1. Create strongly typed array of arrays in TypeScript

    It may look odd, but in TypeScript, you can create typed array of arrays, using the following syntax. For example to create an array of numbers you could write the following:

  2. Array<Type> VS Type[] in Typescript - Stack Overflow

    Apr 25, 2016 · function loggingIdentity<T>(arg: Array<T>): Array<T> { console.log(arg.length); return arg; } And here is a quote from some release notes: Specifically, number[] is a shorthand version of …

  3. typescript - How can I define an array of objects? - Stack Overflow

    Feb 16, 2016 · And Typescript will enforce the type when you pass those around. If you insist on defining a new type as an array of your custom type You wanted an array of objects, (not exactly an …

  4. javascript - Declare an array in TypeScript - Stack Overflow

    I'm having trouble either declaring or using a boolean array in Typescript, not sure which is wrong. I get an undefined error. Am I supposed to use JavaScript syntax or declare a new Array object? ...

  5. How do I find an array item with TypeScript? (a modern, easier way)

    Dec 14, 2017 · How can an item be found in a array using TypeScript, considering ease of use, modern best practices, and elegance via simplicity? (restating the question slightly to seek best approaches) …

  6. Defining array with multiple types in TypeScript - Stack Overflow

    Oct 23, 2020 · I have an array of the form: [ 1, "message" ]. How would I define this in TypeScript?

  7. Array.at () method missing from typescript array type

    Feb 22, 2022 · The Array.prototype.at() method is part of ES2022, which didn't quite make it into TypeScript 4.5. It is part of TypeScript 4.6, so once that is officially released (which, according to …

  8. math - How to sum values in typescript array based on array items ...

    Aug 27, 2018 · 185 Arrays in JavaScript/TypeScript also have these kind of methods. You can again filter with you condition and then use reduce aggregation function to sum the items.

  9. How to instantiate, initialize and populate an array in TypeScript ...

    How to instantiate, initialize and populate an array in TypeScript? Asked 13 years ago Modified 2 years, 8 months ago Viewed 298k times

  10. Access last element of a TypeScript array - Stack Overflow

    Mar 18, 2018 · Is there a notation to access the last element of an array in TypeScript? In Ruby I can say: array[-1]. Is there something similar?