New answers tagged typescript
0
votes
Accepted
Refactored Todolist created using TS
This implements the basics of a class to wrap the code, and shows how event listeners can be targetted at the class instance.
Because the class constructs the necessary HTML framework into a container ...
0
votes
Accepted
Created a todo list in TS
storeObject cannot be both a type and a function. Remove the type storeObject... statement
...
0
votes
Populate object values if an array contains a key
Without knowing what the real word input array looks like, its hard to judge what could be the most efficient algorithm, but as its stands, you have 7*N potential iterations (where N in the length of ...
0
votes
Populate object values if an array contains a key
When I know that I'll be searching in an array multiple times, I usually just put it in a Set.
The Set has method checks if a value is in a Set object, using an approach that is, on average, quicker ...
5
votes
Populate object values if an array contains a key
Your code is very verbose and repetitive.
As it is not a function it is not portable or easily reusable.
Example
Removes as much as the repetition as possible
Encapsulated in IIEF, the days of the ...
3
votes
Accepted
API client that builds a response over multiple lines
By using any you are losing type safety, which defeats the point of Typescript, at least in this spot. But sometimes it’s just easier.
Just because the example is ...
1
vote
Angular - Contact manager component with API
Overall your code already has a decent structure to it. Here are some of the more obvious things that I think could be improved, after taking a look at your project. Some are rather small things that ...
4
votes
Accepted
Updating large and heavily nested JSON properties based on existing properties using nested forEach loops
I don't think there is a more 'performant' way of doing it, as you need to transform all elements. There might be slight tradeoffs over whether forEach is better/...
Top 50 recent answers are included
Related Tags
typescript × 509javascript × 148
angular-2+ × 122
react.js × 56
node.js × 40
rxjs × 37
object-oriented × 31
functional-programming × 21
promise × 19
performance × 15
algorithm × 13
beginner × 12
design-patterns × 12
json × 12
express.js × 12
redux × 12
validation × 11
array × 10
html × 10
async-await × 10
jsx × 10
type-safety × 9
ecmascript-6 × 8
dom × 8
angular.js × 8