menu

Recent questions tagged typescript

1 vote
1 answer
Error when creating a method for a typescript array? Ошибка: Property 'showOne' does not exist on type 'any' Code: Array.prototype.showOne = function(content_body: any, hidden_class: string, html_img: any = undefine ...
by aleshaykovlev
asked Sep 24, 2021
1 vote
1 answer
Why does the Observer method get called again? Receiving data from the server in $events: this.events$ = this.eventsService.get(); this.filteredEvents$ = this.createFilter(this.filter$, this.events$).pipe( t ...
by Junart1
asked Sep 24, 2021
1 vote
2 answers
Is a conditional type possible based on a static class property in TypeScript? Is it possible in TypeScript to take a type based on the contents of a static class property? class A { static bool = true;}function func(A'bool' ? number : string) ...
by lightalex
asked Sep 21, 2021
1 vote
1 answer
How to use interfaces in function parameters? Interfaces serve to ensure that the class implements all the methods and properties that it prescribes. It turns out that interfaces are convenient and should be used a ...
by alex4answ
asked Sep 21, 2021
1 vote
1 answer
I created the app with npx create-react-app my-app --template typescript and npm start gives an error. What to do? Invalid options object. React Refresh Plugin has been initialized using an options object that does not match the API schema. - options.overlay.module: The provided val ...
by mishap45
asked Sep 21, 2021
2 votes
1 answer
image
How do I override a parent class method in TypeScript? There is a code: class A { m(a: number) { }}class B extends A { m(a: number, b: string) { }} The code editor complains that you cannot override a method m with other a ...
by lightalex
asked Sep 20, 2021
1 vote
1 answer
Why is the child class type not compatible with the parent class, cannot be assigned this? Good afternoon, I still can't figure out polymorphic this and why child classes are incompatible with parent classes at some points: class A { parent: A; constructor ...
by alex4answ
asked Sep 20, 2021
1 vote
1 answer
Where do I store my search settings? The method requests data from the server, the server returns JSON object with data about previously performed search, search parameters. There can be several searches ...
by Junart1
asked Sep 20, 2021
1 vote
2 answers
How do I deploy the union to the interface? You can turn the interface into a union with K in keyof T, but how do you enumerate each union member? Expected behavior type union = 'a' | 'b' | 'c'interface I { ...
by fomenkogregory
asked Sep 20, 2021
1 vote
1 answer
Is React.StrictMode breaking the application? The usual todo application . There is a function that, when clicked, puts the mark completed element from the list const toggleHandler = (id) => { setTodos(prev ...
by dmitry-l
asked Sep 20, 2021
2 votes
1 answer
Why are static methods in js bad? I'm writing a front end in Angular. The task was to store filter data in localStore, for this I created a class with static methods: export class FilterStorageUtil { p ...
by liqrizz
asked Sep 20, 2021
2 votes
1 answer
image
How do I set up debug nest.js inside the IDE (PhpStorm || WebStorm)? Hello, everyone! I can't figure out how to configure PhpStorm (or WebStorm) to debug an application on NestJS. Doing this: As a result: 1) breakpoints are triggered ...
by ChernovGV
asked Sep 20, 2021
1 vote
1 answer
image
How do I spell the number|null type correctly? I'm trying to prescribe: export interface ApplicationInit { initialPayment: number|null;}const initialState: ApplicationInit = { initialPayment: null,}; It gives out ...
by lexstile
asked Sep 20, 2021
1 vote
1 answer
Do I need TypeScript to write a Node.js backend? Can I get by with regular js? What are the perks? Wouldn't there be a lot of unnecessary writing compared to pure js? Would it be difficult to store compiled js? ...
by aki2
asked Sep 19, 2021
1 vote
1 answer
Checking array values? Suppose I have a union type type U = 'foo' | 'bar'; How do I make sure that the array contains all these values? I tried it like this: type Validator<U extends st ...
by artr_lr
asked Sep 19, 2021
2 votes
1 answer
How to do this typing? I'm starting to learn TypeScript, and I'm having trouble figuring out how to type these constructs. For example, there are three methods for working with AsyncStorage i ...
by vimirtv
asked Sep 19, 2021
1 vote
1 answer
How do I delete one subscriber if they have the same name? Colleagues, welcome. export type EventHandler = (...args: any) => voidinterface TH { event: string; handler: EventHandler;}export class EventEmitter { private ...
by IgorPI
asked Sep 19, 2021
2 votes
1 answer
Въвеждане на функция, която връща различни обекти? Магьосници от Taipskript, моля, посъветвайте ме как да въведем подобна функция. export function getElementSettings(type: keyof typeof elementTypes) { switch (type) { ...
by CyberTopTuK
asked Sep 19, 2021
1 vote
1 answer
How do I get the correct data from the Redux store? Hi all, I'm new to radish and tapscript. I'm currently learning both, putting them into practice right away. I have a simple React application and have a data file. Init ...