Most voted "typescript" questions
Typescript is a super superset of Javascript created by Microsoft that adds optional types, classes, interfaces and modules and compiles for pure Javascript.
Learn more…1,167 questions
Sort by count of
-
2
votes1
answer1207
viewsTypescript - Error TS1206 Decorators are not Valid here
I really need a help, I can not at all run my app FRONT END, a company project, when I give a npm start on my terminal in visual code, a blessed error persists, which is on @Component saying Error…
-
2
votes1
answer39
viewsFilter in the null returning array
I have the following doubt, I am with that const export const STATUS = [{ 0: 'Rascunho', 1: 'Enviado', 2: 'Processando', 9: 'Processado', 3: 'Agendado', 4: 'Protocolizado', 5: 'Suspenso', 6: 'Erro…
-
2
votes1
answer78
viewsIs there anything that compares the type of the object?
I want to test the type of the object not its value, more or less this: component1: IndexComponent if(component1: IndexComponent) { dosomething(); }
-
2
votes2
answers1941
viewsHow to validate email and CPF at angular 5?
Dear, I would like to know how I can validate the e-mail and CPF in angular 5. I made the basic code: <mat-form-field class="full-width"> <input matInput placeholder="E-mail"…
-
2
votes1
answer90
viewsMy filter pipe is returning the wrong columns from my table
I tried to deploy a filter pipe but realized two wrong behaviors. Having two elements in my table: sfafasf:150,00 and other variable cost: 80,00 When you put the name "other variable cost" in the…
-
2
votes1
answer556
viewsChange attribute of one component into another component at the angle
I have two components: Registration and Login In the Registry I have this anchor: <a id="titleClient">Already have a account? Click here</a> I need when the user clicks on the anchor to…
-
2
votes1
answer65
viewsHow to extend a global method in tests using globalThis?
I’m making a node.js exercise, but the version I’m working on is younger, and has now adopted the globalThis in the instance global. import { SetupServer } from "./server"; import supertest from…
-
2
votes1
answer215
viewsPerform validation in the form only after losing focus on the Validator angle
I’m using the validations of the reactive forms at the angle, I put a valid email validation, the problem is that while the user is still typing the email already appears the . I would like to know…
-
2
votes2
answers79
viewsGoing through an archive of constants
I created the following constant file (constants.ts): export const USER_INFO = 'user-info'; export const USER_SEARCH = 'user-search'; export const USER = 'user'; This file is used to set, retrieve…
-
2
votes1
answer395
viewsPass data from one component to another in angular
I have a component that shows an image and another component that should change the src of that image. This is what I tried to do: Profile.component.ts alteraDadosPerfil(){…
-
2
votes1
answer52
viewsHelp with product registration with images
I am trying to register products, where it is possible to register more than one photo per product. But in the service that I created, I call a for to fill the image matrix, this happens very well.…
-
2
votes1
answer226
viewsngModel validation does not work in select field
I am trying to put a required validation in select and then show if the user fails to fill in. I tried something like: <select required #selecttipoproduto="ngModel"…
-
2
votes1
answer92
viewsGo inside to compare if there are equal values
I need to do one to check if inside my array this.variacaoForm.value.variacoes has a sku like the other, I tried something like: for(let i=0;i<this.variacaoForm.value.variacoes.length;i++){…
-
2
votes1
answer449
viewsSelf complete material how to stay the mat-options after selecting an option?
I’m using the Material Auto Complete Angular After selecting an option from the list the mat-options disappear, I would like them to remain until you click out of the input. Follow gif showing the…
-
2
votes3
answers530
viewsFind an object in the array that has a specific key
I have the following object array: specifications: Array(63) 0: {key: "1", value: null} 1: {key: "11\uFF0E11", value: null} 2: {key: "155\uFF0E50", value: null} 3: {key: "2", value: null} 4: {key:…
-
2
votes1
answer381
viewsProblems while trying to recover data from firebase Realtime database
I’m doing my TCC using Ionic 4 and firebase Authentication and Realtime Database, for a few days I ended up crashing when I try to recover only one user from the database, when the user data is…
angular ionic firebase typescript firebase-databaseasked 5 years, 4 months ago Alexandre Scussel 21 -
2
votes2
answers745
viewsPass more than one parameter in a request in Angular for Webapi
This is the web api: [Route("{pagina:int}/{tamanhoPagina:int}")] [HttpGet] public IHttpActionResult UsuarioPaginado(int pagina = 1, int tamanhoPagina=10) { var _aluno = iAluno.Listar() .Where(x…
-
2
votes3
answers397
viewsFooter does not remain at the bottom of the page
I have the following footer: <footer class="page-footer font-small footer-fundo-cinza"> <div class="container"> <div class="row pt-3"> <div class="col-md-4"> ... </div>…
-
2
votes1
answer1116
viewsMaking sum with angular
Someone could help me, I’m starting to use Angular now, and I’m having a big confusion at the time of how to study... Basically, when I click the button it does nothing... it is possible that the…
-
2
votes1
answer193
viewsRecover cookie with Typescript
hello, I’m passing a jQuery code that I was developing, for Typescript... I had made in Jquery a withdrawal of cookies that was working perfectly. What I need is to pass to the avriável, the value…
-
2
votes1
answer189
viewsformControlName with *ngFor
I have a form with 3 fields q will be used by the user: a select, a textarea and an input. These fields are filled with an ngFor q data comes from the database: <form id="form-group"…
-
2
votes4
answers431
viewsDynamically change class
I have an html with ngFor: <div class="row p-3 border-bottom" *ngFor="let cont of contrib"> <!-- ! --> <div class="col"> <p [class.text-danger]="redName === true"…
-
2
votes2
answers106
viewsHow to replace the value of a string from a certain character?
I have a variable called nameImage. It is named after a photo. Ex: photo.png I need to remove everything after png, getting just the "photo". I tried to:…
-
2
votes3
answers66
viewsHow to run a search on an array until a condition is met?
I have an array of users coming from a firebase database, I capture this array and run a map to capture some information, for example: mount a Cpf array, phone... This Cpf array for example I will…
-
2
votes1
answer453
viewsHow to put maximum value in a Date field in Angular 7?
Look at the picture; You can see from the image that the field is accepting more than ten digits, what I need to do is allow the user to only type ten digits in the data field, I’m having difficulty…
-
2
votes1
answer746
viewsHow to limit an input of type Number to only 3 characters by Angular 7?
I have a problem with a variable of type integer, because maxlength="" only works with string and need to bar, but is of type Number. I think you need javascript, if anyone knows the solution would…
-
2
votes1
answer204
viewsIs it possible to define the return type of a Promise?
Good morning. I wonder if it is possible to define the return type of a Promise with typescript. I need this because I have a function that returns a precedent for a query in the database and I need…
-
2
votes2
answers253
viewsAbnormal behavior when taking data from a Formgroup with Angular
I was finishing a form using Angular and Materialize and noticed that I was not receiving the data from fields generated with "datepicker" of Materialize, even if they have valid text. HTML:…
-
2
votes1
answer342
viewsSelect is not initialized with default value
I created a component that has a type field <select> and receives a property [modelo] as input: if the template is null, the form is initialized empty; if it has content, it is initialized for…
-
2
votes2
answers695
viewsHow to apply a *ngFor to an array of objects in Angular where the name varies?
I have the following array called dadosRelatorio that I need to iterate in my template, that array I get through a request from my backend. [{"id": 1, "name": "a", "class":[{ "Inglês":[{ "id": 1,…
-
2
votes1
answer360
viewsMake input mandatory based on previous input
Guys who can help me, I appreciate. I have some reactive fields in my code, they become mandatory or not based on the previous field, my code is like this <div class="ui-g-12 ui-md-4">…
-
2
votes1
answer31
viewsObject Null in DOM Manipulation
I’m new to Typescript and I have a problem that I’ve been trying to solve for a while. I’m taking a random photo of an API and trying to insert it into an element div. However, I get the following…
typescriptasked 4 years ago Thales Maia 320 -
2
votes1
answer74
viewsType annotation in asynchronous functions in Typescript
I am new to Typescript and I have the following question. It is necessary to be explicit about the type of return of a request fetch? const getPeoples: () => { userId: number, id: number, title:…
-
2
votes1
answer363
viewsTypeorm query with Inner Join is coming empty
I made two tables, Usuario 1 : N Produto I made an Inner Join with Typeorm, but an empty array was coming, so I took the query it was generating to analyze it better. When I played the query in…
-
2
votes2
answers99
viewsProgram a test to check for libraries in the "package.json" type "@types/..." that are in the wrong place. Is it possible?
I’ve taken several times package.json libraries "@types/..." in "dependencies" instead of "devDependencies". It is that they were installed without adding the parameter -D during the yarn add.…
-
2
votes1
answer58
viewsReact + typescript how to pull 1 function within a React component
export function BotaoMenuLink(props: Props) { return ( <> <div className=""> <a type="button" onClick={BotaoToggli} className="bg-blue-700 hover:bg-blue-800 h-10 w-10 rounded-full "…
-
2
votes1
answer104
viewsError in Reload, ts-Node-dev and Prismaclient
Good afternoon my friends, all in peace? I’m having to migrate a small API to Prisma by removing Typeorm. Well, so far I have been able to install and run smoothly, MAS (normal, kkkk). I noticed…
-
2
votes1
answer41
viewsTypescript is not checking map types with spread operator
The following code compiles without any type of Warning. It is some configuration that is wrong/missing? interface CategoryInfo { name: { portuguese: string english: string spanish: string } icon:…
typescriptasked 3 years, 5 months ago Michael Pacheco 1,657 -
2
votes1
answer740
viewsHow to receive query params in React with reatc-router-dom?
I’m making an App, using React with typescript and React-router-dom. But I’m having a hard time working with query params on routes. My initial goal was just to receive the token and email that…
-
2
votes0
answers152
viewsOnetomany / Manytoone Typeorm relationship is not saving the foreign key. The value goes as NULL
Well, I’m using Typeorm in my TCC project. It’s something very simple, nothing very complex. I am using Postgresql to save the data, in the database I have only two tables, a call users and another…
-
2
votes0
answers482
viewsArgument of type 'Iaulasadicional[]' is not Assignable to Parameter of type 'string'
Opa, I have this problem in my code which I am not able to solve, follows below my code I hope you can help me!!! Stoned: "AulasAdicionais": [ { "Periodo": "1", "HorarioInicio":…
-
2
votes1
answer170
viewsProblem typing first parameter of React setState
Hello, I’m a little new to the typescript world and there’s something going on that I can’t explain why. I have the following state: const [estaExecutando, mudarExecucao] = useState(false); Step to…
-
2
votes3
answers65
viewsHow to decrease the amount of if/Else for the same validation of different object properties?
I have some validations of mandatory fields in my application and today I do this way: verificarObrigatorios(): boolean{ if(!this.pessoa.nome) { this.toastr.showMessage("Nome Obrigatório") return…
-
2
votes0
answers35
viewsCalling classes from strings in ES6 modules (commonjs) compiled by Webpack
In a web project with TypeScript, using modules commonjs, compiled via Webpack (version 5), I need to call classes and methods dynamically from type variables string containing their names. I can…
-
2
votes1
answer61
viewsHow do I get a simple change of status from a chekbox in React?
Yes, rookie in React/Typescript. Before anyone tells me to go study the material, I would like to say that I looked at different approaches to this, with different points of view, but none clarified…
-
2
votes1
answer67
viewsEvent "onClick()" running alone
This function is inside a map and within it, executed {Idchecker} The item id. is a value that comes in Array, I need this id to delete the post the user created, so idValue that stores post…
-
1
votes1
answer543
viewstypescript + type definition file (.d.ts) + enumeration (Enum)
I am trying to create a definition file that uses an enumerator, defined in another file, and a declared variable (declare var) in the.ts file, but when referencing this file in another…
-
1
votes0
answers70
viewsCondition if combobox content is selected, load the fields
Good morning Galera, I’m having the following difficulty in typescript, I want to select a field from a combobox, when I select this field, I want you to load certain fields... The problem is that…
typescriptasked 8 years, 9 months ago AleBabaloff 1,104 -
1
votes2
answers1268
viewsAdd Date methods using typescript
I’m trying to create a date format method. Something like var minhaData = new Date(); console.log(minhaData.format('[d]/[m]/[Y]')); I searched the internet and managed to develop this excerpt:…
-
1
votes0
answers797
viewsMask or format input value at angular2
How can I format or use masks on inputs with angular2, for example for money In this input: <input type="text" class="form-control input-sm text-right" id="representPercDiagnostico"…