Questions tagged [TypeScript] (498)

0
answer

How to typecast the return value of the Thunk of action?

Hi. The situation is this: 1) There is an asynchronous action type AppThunk<ReturnType = void> = ThunkAction< ReturnType, RootState, unknown, Action<string> > export const registerUserAsync = (form: RegisterFormType): AppThunk<Promise<RegisterFormType>> => { return dispatch => new Pr...
Federico44 asked April 19th 20 at 12:38
0
answer

How to describe the server API (Rest) at the front React/Redux using Typescript?

How to describe the server API on the front React/Redux using Typescript? maybe there are some practice of how to do it thank you
Nels_Bednar64 asked April 19th 20 at 12:31
2
answers

How to split large file into many angular files, while remaining in the same class?

C# has partial classes and in one class to keep a lot of data in different files. Why I don't want to create subclasses and to invest them? it is difficult to communicate the hierarchy top-down. And in Typescript and Angular I have not found someone like me a huge file split into parts so, like all methods are in one place...
Rosemarie asked April 19th 20 at 12:28
1
answer

How to obtain a set of points on the coordinate plane?

I decided to get rid of the global variables and all data necessary for work functions and pass it through the parameters. For the problem of obtaining the set of points on the coordinate plane I wrote the following code: walls const$ = combineLatest( range(0, constants.wallsCnt), of(constants.canvasWidthPx), of(constants...
Elody_Willms asked April 19th 20 at 12:26
1
answer

Is it possible to connect the Angular project with the React project? For example some React component (project, module) to connect to your Angular project?

I created for example what is the platform for Angular, but my friend Kochetov me to connect an additional piece , an additional extension which was written on React , is it possible ? thanks in advance to all.
Ed_Johnson20 asked April 19th 20 at 12:22
1
answer

Using redux-thunk returned by a function is in action. How to fix it?

export const changeSearchValue = (value: string): Function => { return (dispatch: Function): void => { dispatch({ type: CHANGE, payload: value }); Axios.get("https://www.balldontlie.io/api/v1/players", { params: { per_page: 5, search: value } }) .then(function (response: any): void { dispatch({ type: SET_SUGG...
flavio.Gutma asked April 19th 20 at 12:22
1
answer

How to fix the error when you run the script with cron?

Additional informationFile upload.ts contains console.log(process.argv); Consider a few situations: 1. When you run the script while in the directory root/ team ts-node /root/autoinst/instAPI/bot/upload.ts The script starts but fails with error Cannot find name 'process'. Do you need to install type definitions for node?...
Justine.Simon asked April 19th 20 at 12:19
0
answer

How to add a new type for a function from node_modules?

There is a module react-input-mask. It is a function of beforeMaskedStateChange, it types not yet described. Code types from node_modules: import * as React from 'react'; export interface Selection { start: number; end: number; } export interface InputState { value: string; selection: Selection | null; } export inter...
Reuben asked April 19th 20 at 12:06
0
answer

How to dynamically create the object?

Good day! Such situation: there is such interface: interface IParams { value?: number; current?: number; } interface IObj { params?: IParams; age?: number; animal?: string; } You need to write a function that creates an object with only the key that came. That is, if the key value then the object should look like this...
adolph.Abbott asked April 19th 20 at 12:04
2
answers

What type of event you need to register?

Good evening, prompt please how to register type in this case? Using select from material ui. currentTarget.use innerText to get the text in a MenuItem const handleChange = (event: any) => { if ( event.currentTarget.innerText === 'BALANCE' ) { setSendForm({...sendForm, balance, event.target.value}); setCBal(true); ...
Madisen82 asked April 19th 20 at 12:01