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
-
3
votes1
answer114
viewsHow to transform string into Date object with Typescript?
I am receiving from the HTML form a string containing the date selected in the pattern dd/mm/yyyy, and want to create an object Date from that string. The problem is that the Date only accepts…
-
3
votes1
answer194
viewsRefresh token requests delayed
How to make the token be created at the same time the method gets: The way I implemented it, it checks that the token was created, but the token used for the request is the expired token. Only after…
-
3
votes1
answer588
viewsHow to start an object in Typescript without declaring all properties at once?
Taking into account the following interface: interface Usuario { nome: string; senha: string; email: string; } It is possible to declare an object "slowly" without creating a new type or interface…
-
3
votes1
answer41
viewsOmit extended typescript typing
When using the Mongoose library, typing a model can be done with an interface that extends the type mongoose.Document. This approach is working according to the example below: import mongoose from…
-
3
votes1
answer169
viewsWhat is the difference between "test" and "spec" in automated testing?
The question and doubts below address Node.js, Typescript and Javascript. I don’t know if the concepts below apply to other programming platforms/ languages. I am studying about automated tests (AT)…
javascript node.js typescript software-engineering testingasked 3 years, 4 months ago Cmte Cardeal 5,299 -
2
votes0
answers84
viewsFacebook page does not open with click - Nightwatch
Hello, I recently started working with Nightwatch.js. I want to test the facebook icon. The code is this: module.exports = { "Facebook link" : function (browser) { browser…
-
2
votes1
answer37
viewsComponent is printed 2 times in browser
Good guys, I’m developing an app with angular2 final version using routes. I created some files and then came across a problem of routes. My Component Home is printed 2 times in the browser. In the…
-
2
votes1
answer236
viewsIntercept all HTTP requests from angular2
I’m looking for a way to intercept all HTTP requests from the angle and add a few headers. In versions prior to angular2 RC5 (before the NgModule) was that way, for example: class MyOptions extends…
-
2
votes2
answers2343
viewsHow to convert a javascript file to ts format?
I know that the Typescript language is used to compile Javascript files. But I wonder if there is any tool that makes it possible to do the reverse. Is there any way to convert a Javascript file to…
-
2
votes2
answers2070
viewsHow do I emulate an Ionic 2 application on the tablet, and also as Gero a . ipa and . apk?
I want to emulate my Ionic 2 application on the tablet but I can’t, I’ve already uploaded an Ionic cloud but only works in the Ionic view app, I’ve also used Ionic emulete and Ionic run, but when I…
-
2
votes0
answers483
viewsCreate Form with Components at Angular 2
I’m starting with Angular 2 and I have a question, I believe simple, in the creation of forms: For example in a system that contains the following entries: Customers Suppliers Carriers Each…
-
2
votes1
answer639
viewsGroup data with Ngfor and Groupby
Before in Angular 1 when I wanted to make a grouping of data I did so: ng-repeat="(key, value) in me | groupBy: 'role_id'" In my object me had a list of users with a field role_id different. Then I…
-
2
votes0
answers135
viewsHow to set up quaggaJS for Brazilian billets?
Hello I am testing the quaggajs sandbox and I would like to know if anyone has made specific settings for the operation in Brazil. I tried to run the sandbox that is available on the site, but it…
-
2
votes1
answer119
viewsRedeem user phone number
On Android, using Java, it is possible to redeem the device user’s phone number with the following code: TelephonyManager tMgr = (TelephonyManager)mAppContext.…
-
2
votes3
answers2758
viewsOpen google maps app via link via Ionic 3
I need to make a link that opens external google maps app on android and Ios (apple maps) that opens with marker in a certain coordinate. So far, the research found something similar to the…
-
2
votes1
answer451
viewsView Firebase Child in Ionic
Hello! I have a project on Ionic that I need to display some promotions, however I need to "update" them after the app released. For this I’m using Firebase! I managed to display in the app what I…
-
2
votes3
answers434
viewsSynchronous query in Sqlite using Ionic
I have the following function below: public requisicaoXPTA() { this.database.executeSql("SELECT * FROM tbl_xpta", []).then((data) => { // o resultado retorna aqu na variável data }, (error) =>…
-
2
votes1
answer353
viewsFirebaselistobservable transforms into Object Array
I am using Ng2-Smart-Table, according to the documentation it accepts an array of objects to mount the table: In HTML: <ng2-smart-table [settings]="settings"…
-
2
votes0
answers1870
viewsBarcode scanner for browser
The scenario is as follows: I’m creating an application in Ionic 2, but I need it to also be accessed through a URL in a browser, like Chrome. One of the requirements of this application is that it…
-
2
votes1
answer707
viewsVisual Studio Error - Cannot find name 'Record'
I am working on an ASP.NET project with c# in Visual Studio 2015 and I came across an error in the file index.d.ts. The error messages are Cannot find name 'Record' and Cannot find name…
-
2
votes1
answer286
viewsDoes typescript support an implementation equivalent to trait?
I am developing a project using Ionic, and would like to better organize my classes. Below is an example of how I would do with PHP: <?php trait comportamento { public function ficarTriste() { }…
-
2
votes1
answer233
viewsHow to use the reference of a Barrel file in the same folder with Typescript
I’m having trouble referencing files that are in the same folder when working with a Barrel type file in my project is in Angular (version: 4.0.0). My problem is this, see the file and directory…
-
2
votes1
answer510
viewsPass variable in *ngIf
I have a variable in my input.component.ts calling for validacaoExterna, that receives a string from whoever is going to use it.. @Input() validacaoExterna: string; In my input.component.html I have…
-
2
votes1
answer47
viewsThe use and non-use of the word Function in Typescript
Why when I declare method in a class the compiler beeps, stating that the word usage is wrong function. In previous lessons of my learning to create a function I signed first as function. abstract…
-
2
votes1
answer671
viewsHow to instantiate Httpclient in Angular 4 typescript?
Based on this example for Http, I would like to know how to instantiate Httpclient: **constructor() { const browserXhr: BrowserXhr = new BrowserXhr(); const baseResponseOptions: ResponseOptions =…
-
2
votes2
answers59
viewsError in this in a typescript function
I have error in the function below: export const throttle = (func: Function, limit: number) => { let inThrottle: boolean; return function () { const args = arguments; const context = this; if…
typescriptasked 6 years, 1 month ago Marquin Ferreira 362 -
2
votes1
answer3402
views"TS1005: ';' expected" error when compiling class with Typescript
I am studying Typescript classes through official documentation: https://www.typescriptlang.org/docs/handbook/classes.html. I used exactly the same example code as the documentation: class Greeter {…
-
2
votes1
answer876
viewsDelay on application startup
I created a cross-platform application using Ionic 2 + Angular 2 according to the Get Started of ionic documentation. The basic command to create a project with side menu is this way below: $ionic…
-
2
votes1
answer62
viewsWhat is the default visibility of a variable in Typescript, what is the importance of var when declaring variables?
When declaring a variable, when we omit the visibility parameter (public, private and protected) the variable is created by default in which visibility? export class AddEditTaskPage { idade: number;…
-
2
votes1
answer669
viewsHow to break lines according to a value
How do I break lines according to the value ? For example a = 8. There I have a variable "d" q takes a string. var d = "written work considered in its original wording". If I put an If = a; it…
-
2
votes7
answers7167
viewsHow to receive the CPF number and format to be without the dots and dash(Input Mask )
I’m creating a mask with inputMask, but the number is received so: 222.222.488-19. And I want him to have the mask on input but when sending it will be without the dots and the dash. Like this…
-
2
votes1
answer263
viewsTypescript "private" access modifier
In most examples I find Typescript I see that the class attributes do not use the access modifier private. It is a matter of design or there is some difference in operation compared to Java? export…
-
2
votes1
answer1194
viewsPOST with angular 5
so I’m trying to make an app with angular 5 using auth with token. For this, in the login, I need to do a post on my API (which I tested by Postman and is working), but I’m having trouble doing this…
-
2
votes2
answers619
viewsIt is possible to return a Observable<Boolean> from the get request
I need to check if the api is active. Basically I’m trying to check if the request status is 0; if so, I know the api is out of order. But I wanted to put this method in my service class and only…
-
2
votes1
answer561
viewsTansformate a JSON response in a list and display the data on the screen with IONIC
Good afternoon guys, whenever I have any doubts I run here hoping you will help me and always get positive answers, from now on my many thanks. Well, I have a little problem here (I don’t have much…
-
2
votes3
answers165
viewsProblem checking if a type any is Undefined in Typescript
I am having a problem checking if a variable is Undefined in the following typescript code. Atendimento:any; this.Atendimento.Checkout.Observacao == undefined ? '' :…
-
2
votes1
answer191
viewsAsync/await javascript
How can I make the code below less messy with asnyc/await? class Backend { getUsers(callback){ const database = firebase.database().ref('users/') const onReceive = (data) => { callback({ data )}…
-
2
votes2
answers552
viewsCustom input component
Hello, I have a form 'Reactive Forms' where it has several fields, (several inputs), so I decided to create a Component and run an ngFor on it to reduce the number of lines... Component html <div…
-
2
votes1
answer100
viewsUpload image without page load
Good evening, I’m uploading file, it’s working but every time I send the file to page updates, could someone give a tip on how to fix it? I’m using angular 5. Component. OnSubmit(){ const formData =…
-
2
votes1
answer411
viewsPOST method in Angular
I have a simple Angular application and need to make a call to my API to get one token. But I am facing difficulties. I will try to explain a little about my flow. I created a service class where I…
-
2
votes1
answer465
viewsPutting a start time in Input date
Good afternoon, could you start the input date field with the time already filled ? in case I wanted to start with 23:59 and the date field to start same normal. Thank you
-
2
votes1
answer139
viewsSearch Array with case-insensitive javascript variable
I need to search an array with values of the type: equipamentos = [{marca: 'Nomedamarca1', modelo: 'Modelo1'}, {marca: 'Nomedamarca2', modelo: 'Modelo2'}, {marca: 'AlgumNomeComCase', modelo:…
-
2
votes2
answers763
viewsAsync/Await x Sync
I’m studying synchronous/asynchronous behaviors at the angle and I’m not sure when to use async and await.... Correct me if I’m wrong... I understand that for me to call with await, the return has…
-
2
votes0
answers275
viewsDefine Matdatepicker component format
How to define component format Datepicker in Angular 6. In my Angular 6 application, I am working with the database Cloud Firestore of Firebase. When performing a document query, when the document…
-
2
votes1
answer4397
viewsForm validation with angular 6
I have this form, very simple, with just a field and a button. I gave a required input, and when I write with the empty and/or null field, it does not write(correct), but already switches to the…
-
2
votes1
answer95
viewsWhat is Simplechanges in Angular? Is it an Angular API?
I have the following code: @Input() listas: IniciarFuncaoModel; ngOnChanges(changes: SimpleChanges): void { if (changes.listas) { this.iniciarFuncao(); } } Simplechanges is an Angular API? I…
-
2
votes1
answer42
viewsHow to get the last n elements of an Observable?
I own a service that is receiving an array objeto API with the function below: getUltimosDados(n: number): Observable<Objeto[]>{ return this.httpClient.get<Objeto[]>(this.enderecoDaApi +…
-
2
votes2
answers238
viewsHow to compare only the date with Date objects?
I want to create a function group that compares dates in Typescript. So far I have the following: function amanhaOuDepois(date: Date): boolean{ if(date > (new Date())) return true; return false;…
-
2
votes2
answers88
viewsTypescript files in version history
I started using Typescript in my web project to generate the Javascript files and my question is: In the version system I should put only the Javascript files, Typescript or both?
-
2
votes1
answer183
viewsSelect array to save
Making an array of selects using multi-select, but select them is not communicating, when I select one appears in the json, but when I go to select another subscribes those I selected. I’m using…