Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [typescript]

Typescript is a language which is a super set of JavaScript

-1
votes
0answers
9 views

Need a critics for my TypeScript+Knockout project [on hold]

Here's my demo project for TS+Knockout. Need your critics and advises how to enhance the TS part.
-1
votes
0answers
23 views

Light Bulb State: State Design Pattern

I have the following code using Angular framework in using typescript language. I was working on a dumb project in order to learn about state design pattern. State ...
1
vote
0answers
22 views

Nodemailer class

I created the following class for sending mail in my node.js API : ...
2
votes
0answers
9 views

Automatically generate TypeScript classes from database tables

Made a project to generate TypeScript classes from database tables, and I'm looking for input if the code is reasonable. pg and ...
-2
votes
0answers
19 views

Multiple classes to make multiple calls to backend systems [closed]

I have implemented pattern that has to make two calls to different api and combine the response, I need help here from experts if there is any better way or best practice to acheive these task. In ...
2
votes
0answers
24 views

Addition of defaults to components in AngularJS

I wrote a small module in typescript that augments the angularjs registerComponent function to provide a new way of default values for the component controller. ...
1
vote
2answers
69 views

DataService that fetches data not loaded already or loads cached values

I load an array from an API that is available throughout the user's whole session. This data is unlikely to change, so it can be cached safely. I have a DataService ...
1
vote
0answers
13 views

Angular2 “Logged In State Watcher”

I have a small website I'm working on as a hobby and I created a login page/home page so far. I wanted to get the basic login/logout functionality going before filling out the main part of my site. ...
3
votes
0answers
35 views

Tic Tac Toe game (Game logic, no UI)

I've implemented a simple class for managing a Tic-Tac-Toe game's logic and state in Typescript. This code is intended to be used by a larger program; it doesn't implement any aspects of a UI. I've ...
0
votes
1answer
17 views

An Angular service to provide window and document objects

In some components and services I need the window and document. So I created a small service, that provides these two objects. ...
1
vote
1answer
33 views

Language switcher, consulting browser's localStorage

I'm using angular 6 and ngx-translate. This is my switch language function ...
0
votes
0answers
6 views

Consume GuerillaMail APIs to create and read emails

This class is part of the integration tests for our Auth API using supertest and it's using GuerillaMail as disposable email client to retrieve user registration confirmation email, reset password, ...
0
votes
0answers
81 views

Angular async pipe with loading spinner and manual refresh

I have an Angular 6 app with the following requirements: Get data from a web service. Load the data when the page is displayed. Reload the data when the user requests a reload by through some UI, ...
1
vote
2answers
46 views

Generic function with same logic but different input structure

I have a data structure that looks like this: interface Node { originalWeight: number; currentWeight: number; } where both properties are floats between <...
5
votes
1answer
51 views

Angular directive to disable a button when clicked, allowing re-enabling as needed

I have written an Angular Directive that disables a button after it has been clicked, to prevent double posting / saving of data. This works fine in most of our use cases. However, in some situation ...
5
votes
4answers
55 views

Calculating total size of player data

I am writing a function to calculate the total size of a "player appearance". There are various "item slots" the player has, and if they are empty then 1 byte will be sent, otherwise there will be 2. ...
3
votes
0answers
44 views

Optimizing NICK binary thresholding

NICK binary thresholding essentially boils down to a convolution where the kernel at each pixel calculates the sum and squared sum (for the standard deviation). These values are then used in the ...
1
vote
0answers
36 views

Test for an array being subset of another master array

This is my first question in this forum. I was trying to build a small utility function to check if array is part of other array. Testing if an array is subset of another master array. ...
2
votes
1answer
63 views

Angular service for fetching and passing data with observables

I have an Angular service consisting of three methods: This method makes a call to my server to get a URL ...
0
votes
0answers
30 views

Asynchronous API handler function to update a game

I think mainly the GameController can use some optimization Game Entity.ts ...
1
vote
1answer
250 views

Checking whether an array contains a value or another array

I'm designing an isIn method that takes a value:any and checks whether it exists in an array. It's working, but I'm wondering ...
0
votes
0answers
28 views

I have three classes which all make API requests, how can I refactor their similar methods?

I'd first off like to apologize if this is the wrong place to post this question, but I figured that code review would be the most relevant place (compared to stackoverflow and softwareengineering). ...
0
votes
0answers
154 views

Checkboxes behave like radio buttons with angular

This is short Angular 5 code which works as intended: check boxes behave like radio buttons - only one can be selected at a time. Both versions of 'toggleCheckbox' works but I am interested is if ...
0
votes
2answers
93 views

JS code that search through every property in a nested object

I wrote code to search by keyword, and it will check all of the values from the object property, including an array in the object. But apparently the code is not optimized as it takes some time to ...
1
vote
0answers
57 views

Angular form data over multiple components

I have a form that I have broken into several different components in Angular. By the end of the form, all the data needs to be submitted together. My thought process was to create a provider to ...
1
vote
0answers
18 views

Firebase Plotter for Ionic

I've written this plotter for Ionic in Typescript to plot data that I push to a Firebase list. I'm new to Typescript so I'm interested in all kinds of feedback, especially on the style. First I've ...
7
votes
3answers
154 views

Find the fastest run of each year from a list of running results

Problem Explained: Imagine there is a list of running results of 1000m, like following: ...
3
votes
2answers
179 views

Creating nested objects from string

I implemented a method, to create an object based on a series of strings that are passed to it, of any depth or length. The way I implemented the solution was to map over the arguments. Assuming that ...
0
votes
0answers
28 views

An npm package to mirror/clone text areas without jQuery

I've been trying to get away from jQuery lately and needed to re-create a script I used for mirroring text inputs. npm i mirror-txt.js to include GitHub <...
0
votes
1answer
114 views

Promise-based fixed delay poller with timeout

I have the following functions for polling some function periodically with a timeout ...
5
votes
0answers
130 views

Factory method done on reactjs component,

A Factory Pattern or Factory Method Pattern says that just define an interface or abstract class for creating an object but let the subclasses decide which class to instantiate. In other words, ...
2
votes
0answers
154 views

Robot on a Grid: Find a path between two corners with forbidden cells on the road

Problem statement The problem is defined in the book as following: 8.2 Robot in a Grid Imagine a robot sitting on the upper left corner of grid with r rows and <...
0
votes
0answers
108 views

ReactJS Component that retrieves quotes

I have created the following React Component and wanted to have feedback about if its SOLID or not, and what can I do to make it SOLID? I do believe its SOLID but would like feedback from guys with ...
0
votes
0answers
51 views

Parse big JSON for reactive form

I implements big reactive form on angular5. This form get data from JSON. I use formBuilder and several nested formGroups. Every field have default value before rendering form. In console output form ...
1
vote
0answers
43 views

Redux-like implementation in TypeScript

I need to write a custom reducer utility. It should take a dictionary of reducers and a publish subject to return a state, with a dispatch method to dispatch ...
1
vote
0answers
37 views

React Text Highlighter HOC in TypeScript

I'm shifting my focus towards frontend as much as I can, but I'm still quite unsure if I'm writing good code or not. Please take a look ...
0
votes
0answers
22 views

Jasmine tests for tax calculations in Angular 4

I am writing Jasmine tests in an Angular application and need to verify if I am testing correctly. If not, I would like suggestions in what area I should actually test. If you see in the code, ...
2
votes
1answer
46 views

Which will be better declaration go to with TypeScript? [closed]

This is a simple question, but during my migration to TypeScript, I'm seeing that in many cases my code could take these two directions... which one could be a better direction to go with: ...
0
votes
2answers
38 views

Picking a time based on when the app was last used

I am trying to set up a time variable as a local storage property to be retrieved when I open my app in my browser. If I open it for the first time, today, I'll set it up to today at midnight. ...
10
votes
1answer
105 views

Checkers Board Creator

A year or so ago, I wrote a checkers game for the Universal Windows Platform. Now, I wrote a web-based version of it hosted at http://checkerstreasury.azurewebsites.net. This is the first of a series ...
3
votes
0answers
28 views

The Beginnings of a HexCells Editor

This is my first foray into a full TypeScript program, and one I decided to do for fun and without the aid of jQuery. It is also my first time developing with the HTML canvas. That's quite a lot of ...
4
votes
1answer
132 views

Filtering objects according to required and preferred attributes

This my opportunity object which is a part of my angular app.component.ts file. In my template(HTML of this component) I want to ...
1
vote
3answers
49 views

Find deviations for a class in C# and present the values in a browser with TypeScript/JavaScript

We have a client that handles three different sort of licenses. These are up for renewal every year and upon renewal they need to check between 15-20 rules to see that everything is okay. They do this ...
5
votes
0answers
31 views

Macao, a General Game Playing AI library - Game state goes in, best move comes out

I'm working on a simple General Game Playing AI library. The idea is that it should work with almost any kind of game, with a minimum of configuration. At the moment, I have it working on 2 player ...
3
votes
1answer
66 views

Updating an offset in a buffer after each read

I'm having a bit of a debate at work regarding when to replace numeric literals with variable names. I have a function that reads data from a buffer and after each read, updates the offset so that ...
3
votes
1answer
200 views

Storing a fetched list of printers in Angular

I have a need to store data retrieved my ASP.NET Web Api to stop making redundant API calls for the same data when I navigate through my Angular page. On my API I have a database which stores a list ...
4
votes
1answer
71 views

Local weather app made with Typescript

I would like feedback on my Local weather app. This site simply gets the local weather. I refactored it from jQuery to Typescript to try to learn more about Typescript. Here is a demo: https://...
6
votes
1answer
140 views

State Monad in TypeScript

Here's my implementation of State Monad in TypeScript, based on a canonical Haskell implementation. I would like it to get code reviewed. ...
3
votes
1answer
77 views

Transforming data from an API using Typescript and Lodash

As a front-end developer, I am given the following result from an API, an array of objects that looks like: ...
3
votes
0answers
208 views

Filter properties and format values if they are currency

The function I've written in Typescript works great, but I'm not convinced that it's the cleanest and most efficient function. The function takes an object, omits properties found in an array, and ...