Questions tagged [typescript]

33566 questions
1

votes
1

answer
233

Views

How to install bootstrap 4 version beta.2 in an angular 4 application?

I tried installing bootstrap 4 version beta.2 and its dependencies (jquery and popper.js). but there is something very weird going on. for some reason, I keep getting an error message in the console, saying 'SyntaxError: export declarations may only appear at top level of a module'. when I click to...
Kenchi
1

votes
1

answer
43

Views

Array.Filter and find not giving error angular 4

I have a list and I just want to filter. Array.find and filter are all producing errors. Function : setSupplierDetails(supplierId) { const supplier = this.suppliers.filter(tempSupplier => tempSupplier.id === supplierId)[0]; this.supplierName = supplier.supplierName; } Error : ERROR TypeError: Can...
user3701188
1

votes
0

answer
143

Views

IO.FileSystemWatcher not working after Windows Update version 1709

I have a powershell script that watches a folder for file changes. After installing the Windows 10 Creators update 1709, the File watcher is no longer being triggered when files are saved. We have a few others on the team that are seeing the same issue, does anyone have any ideas on how to resolve t...
WhizBang
1

votes
2

answer
123

Views

typescript: create interface for cryptocompare coinlist API

I'm trying to make a TypeScript interface for the cryptocompare coinlist API (https://www.cryptocompare.com/api/data/coinlist/) I have currently tried this: interface CoinListResponse { Response: string, Message: string, BaseImageUrl: string, BaseLinkUrl: string, Type: number, Data: Array } Now, tha...
DazDylz
1

votes
0

answer
64

Views

Using Map() with typescript in VSCode shows error message

When using Map() with typescript and VSCode I get the error message: Can not find name 'Map()' with VSCode even thou compiling and executing works fine and without errors. How can I get rid of the error message? I am not sure if this is a bug within VSCode or with my configuration. I assume the late...
Jodo
1

votes
1

answer
27

Views

pass parameters in api js

I need to pass login and email to const validateUser but i dont know how i can do it import { UserEntityModel } from './model'; const port: string = '3000'; const baseUrl: string = `http://localhost:${port}`; const usersUrl: string = `${baseUrl}/users`; Here i pass the login and email export const...
1

votes
0

answer
139

Views

ionic error : help to resolve it

I have service import {Injectable} from '@angular/core'; import {Http} from '@angular/http'; import 'rxjs/Rx'; @Injectable() export class MainService{ http:any; baseUrl:String; constructor (http:Http){ this.http = http; this.baseUrl = 'https://someurl.ru/api/'; } getCategories(){ return this.http.ge...
Victor Tihomirov
1

votes
1

answer
4.4k

Views

Window object in angular 5 service

I have project in Angular, user's panel in specific. All page is in php, just panel in angular. How to use window object in service? I want use window.location exactly for the same action as href='/' in HTML, which return me to outside the angular project(panel) to main site. Why? When I was trying...
Foliano
1

votes
0

answer
61

Views

angular2 asynchronous execution

I'm having multiple functions in a ts file like below. reply_click(event) { var target = event.target || event.srcElement || event.currentTarget; var idAttr = target.attributes.id; sessionStorage.setItem('geo', idAttr.nodeValue); var value = sessionStorage.getItem('geo'); var NT = sessionStorage.get...
Depi
1

votes
1

answer
90

Views

ts-node error: Could not find a compatible `parseConfigFile` function

I just install the ts-node with npm install -g ts-node but I can't execute the REPL, it gives me this error: /usr/lib/node_modules/ts-node/src/index.ts:478 throw new TypeError('Could not find a compatible `parseConfigFile` function') ^ TypeError: Could not find a compatible `parseConfigFile` functi...
geckos
1

votes
0

answer
365

Views

Uncaught ReferenceError: exports is not defined in visual studio 2015

Software: Visual Studio 2015 When i try to run my application i am getting error as below in my chrome console. Console Error :- String.js:2 Uncaught ReferenceError: exports is not defined Detailed Error:- Object.defineProperty(exports, '__esModule', { value: true }); Code snippet as below String.ts...
Rahul
1

votes
0

answer
149

Views

How can I in Angular 5 pass in a value from the command line?

In a Typescript Angular 5 application, I know how to use environments to vary conditions based on the --env command line argument to ng serve/e2e/etc. But for one of my environments, I need to be bale to specify on the command line a dynamic VALUE and then use that in one of my environment variables...
Steven
1

votes
0

answer
60

Views

Creating a type to extend React.Component with class attributes

I'm trying to bring Typescript into a project that extends react components with various additional class properties. I'm trying to work out how to extend the React.Component type to incorporate those additional attributes. As an example of what I mean, in both class and functional form: class Sampl...
Kevin Rocker
1

votes
1

answer
1.9k

Views

Cannot find type definition file for 'node' error in angular

I am new in Anguar2. I am working on MVC Core. When I am trying to run my application after debugging, I can view the screen but after few seconds I am getting the following error: 'in E:\Websites2017\MVC\MVC6\Angular2ASPCORE\Angular2ASPCORE\node_modules\angular2-platform-node\node-location.d.ts (1,...
Partha
1

votes
0

answer
815

Views

*ngFor not updating in child component after modify object

I am using below code to bind data using *ngFor. --Child Component 'my-productDetails'. import { Component, Input, NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; @Component({ selector: 'm...
Shakeer Hussain
1

votes
2

answer
647

Views

Angular 2 app not working - Blank page

I am using Chrome browser, Angular 2 with TypeScript. Following is my code; index.html Angular 2 - Simple Reddit System.import('app.js') .then(console.log('app.js Loaded!!'), console.error.bind(console)); app.ts: import { Component } from '@angular/core'; import { NgModule } from '@angular/core';...
Sid
1

votes
1

answer
107

Views

Force Developers to add comments in function

I know it must be a simple question. But I tried hard googling around this but couldn't find a single suitable result. I'm managing a big team with large number of people working under me. I want to make sure that, every single function written by my developers should have a comment before it. It ma...
Sahil Purav
1

votes
0

answer
87

Views

Mapping generic parameter to compile time data in Typescript?

I'm playing around with trying to disentangle a codebase from Sequelize. Right now we have tons of code like: // Defining interface for model instances interface UserInstance extends Sequelize.Instance { ... database field here ... } // Wrapper class managing connection & model definitions class Db...
Chris Tavares
1

votes
0

answer
64

Views

Angular2 and Typescript how to make the field get cleared and get editable in respective popup using Angular2 and Typescript

Hai i have a address field, wherein in add popup field i want the address field to be empty when i open the new popup but now it is prefilled with the previously entered address and in edit field i want the address of that particular row to be editable but now it is empty. HTML: ADD PopUP: Address F...
Bhrungarajni
1

votes
1

answer
37

Views

Describing mixins in a declaration file

Assume an existing Javascript framework for which you want to create typings. The Javascript code uses Node.js modules, prototypical inheritance and mixins: // File: src/lib/a.js function A() { this.isA = true; this.type = 'a'; } module.exports = A; // File: src/lib/b.js var A = require('./a'); var...
Fabian Iwand
1

votes
0

answer
220

Views

Angular 2 call Observable on component Initialize

I want to call observable on component load. In Below function. I have monthly() in service in which i am sending data using subject next(). I want to send data from load component to receive component. current when i hit toggle-button using (change) event data is sen correctly to receive function b...
Jay
1

votes
0

answer
2k

Views

Critical dependency: the request of a dependency is an expression

Im trying to add gpio support to a project on my raspberry pi 3 model B but i keep encountering an error with bindings when i try to ng serve my app. This problem persists when I try to use any other gpio package. WARNING in ./node_modules/rpi-gpio/node_modules/bindings/bindings.js 76:22-40 Critical...
Dennis Van Bets
1

votes
2

answer
6.7k

Views

OrderBy pipe in angular 4

I'm trying to write sorting pipe according to code in this link: http://www.advancesharp.com/blog/1211/angular-2-search-and-sort-with-ngfor-repeater-with-example Although I have trouble with dealing with undefined values. My pipe works correctly on columns where there are not any undefined values. B...
przemlat
1

votes
0

answer
259

Views

About use minio in angular project

import * as Minio from 'minio'; export class MinioClient{ minioClient = new Minio.Client({ endPoint: '54.223.109.***', port: 80, secure: true, accessKey: 'KM1W4S0TGK3T43YUMW**', secretKey: 'Z/2lurXwZieIguM7MQcQCEZ8CdUBBc7V0fOkKw**' }); getListBuckets():void{ this.minioClient.listBuckets(function(err...
Jack Chen
1

votes
2

answer
323

Views

Saving more data on socket.io object in typescript

I usually used to do something like socket.username = username when not using typescript. But now i am and when i try to save it the same way it gives me the error Property 'username' does not exist on type 'Socket' I know this means i need to extend it, but i have tried it like so interface Socket...
Anup
1

votes
1

answer
885

Views

How to spy/mock method calls in the constructor of a Angular 5 service?

I have a service, that makes 2 method calls in the constructor: constructor(private http: HttpClient) { this.apiURL = environment.apiURL; this.method(); this.method2().subscribe(); } I'm trying to test this service in the TestBed. However, I am unable to spyOn, using Jasmine's spies, before the Test...
Ka Mok
1

votes
3

answer
113

Views

Best practices for defining an entirely new type in typescript?

I have an execution environment with several constants globally: TOP = 1 TOP_RIGHT = 2 RIGHT = 3 BOTTOM_RIGHT = 4 BOTTOM = 5 BOTTOM_LEFT = 6 LEFT = 7 TOP_LEFT = 8 It is clear to me that these 8 constants are not just arbitrary constants, but actually a set of directions. Therefore, I would like to...
Stack Tracer
1

votes
2

answer
1k

Views

How to create form Builder for Dynamic fields Angular 4?

I was creating fields dynamically based on Json. For example if my json array has 3 value then i will create 3 input checkbox dynamically like below All now i m trying to create formBuilder for this fields like below but its not working. Could someone please tell me how to declare formbuilder for dy...
Munna
1

votes
1

answer
51

Views

How to delete particular array shown in grid and need to pass the id of the array?

I have created the simple grid and I have remove button in every table row. If any data in db, it's shown in the view and if user need to add more file,clicking on add new button,my modal array(Colum in code) push the empty array to view. The problem is while clicking 3rd index array remove button i...
Arun Kumar
1

votes
1

answer
25

Views

Typecasting nested methods using the dot operator in typescript

So I am looking to get type checking in my VScode editor on a nested property. I am using AngularFire and want to apply the CollectionReference to the output of the ref property in the following. This is the full statement this.db.collection('collections').ref.doc().id The above, if broken into mult...
krv
1

votes
0

answer
116

Views

Is there any package for atom which autocompletes custom components?

I installed lots of packages to atom including emmet,auto complete HTML,angular and typescript plugins. All standard angular tags gets loaded. But my custom component name don`t get loaded. Do we have a plugin for this ? This is my HTML file This is my component ts file
AMendis
1

votes
0

answer
463

Views

Use d.ts files without TypeScript (instead of JSDoc)

I'm working on a JavaScript project using babel. I've used .d.ts files to define types for each .js file / class just for code completion instead of JSDoc. This works fine when importing the Ability.js files within an other class. All the type definitions work for both variables and functions, and I...
Jeffrey Lanters
1

votes
0

answer
189

Views

asynchronously use window.open in Angular

I have the following code that when the user presses the button in the form below it makes a server request and accordingly open a new tab or display an error search() { const serial = this.searchForm.get('searchValue').value; this.service.check(serial) .subscribe(resp => { if (resp) { this.denied...
callback
1

votes
0

answer
140

Views

how to test component routes in own spec file

I want to test the routes used in a component. I know that I can do this in files with .spec extensions for each class in the angular framework. a sample code(in TypeScript): import {Routes} from '@angular/router'; import {TraderPurchasesComponent} from './detail/purchases/trader-purchases.compone...
Ensar Akbaş
1

votes
0

answer
134

Views

file uploading at client side using Angular 2/4 at angular cli assets folder

I am new for angular 4.I wanted to upload image at client side folder, But I don.t know how to do. below is the code openFile(event) { let input = event.target; for (var index = 0; index < input.files.length; index++) { let reader = new FileReader(); reader.onload = () => { console.log('result',read...
user8231860
1

votes
0

answer
46

Views

Understanding how to declare functions in typescript interfaces

I'm learning Typescript and I get stuck defining an Interface: Javascript code is this: const client: Client = new Resource({ token: 'xyz' }); client.events.create({ id: userId, event: eventName, created: formatDate(date) }, doSomething(cb)); What I did is: interface Client { events: EventsClient; }...
Ayeye Brazo
1

votes
0

answer
274

Views

Angular: error, not installed as it should

I'm new to Angular 2 and Angular CLI environment. I'm working on a project and when tried installing angular CLI and related stuff. It got installed but: When ng --version is checked Angular CLI: 1.6.1 Node: 6.12.2 OS: linux x64 Angular: error ... animations, cli, common, compiler, compiler-cli, cor...
Yashwanth M
1

votes
0

answer
442

Views

Angular - How to navigate to a form control within reactive forms?

I have a parent component which is a table of user data. I created a child component for each row in that table. The table looks like the following: Parent Component HTML: User Tool Role(s) Within my child component (TR), I have ab input that I am trying to name with formControlName='Role'. Child Co...
SBB
1

votes
2

answer
321

Views

Ngrx: Property '[Symbol.observable]' is missing in type 'Store<boolean>' error

I'm using NGRX v4.1.1 in an Angular v5 app (with 'strictNullChecks': true, though it doesn't appear to matter). I'm seeing an error with the store. Given the following: showLists: Observable; constructor(private store: Store) {} ngOnInit() { this.showLists = this.store.select('contactsFeature', 'con...
John
1

votes
1

answer
256

Views

Karma-typescript Interface XXX cannot simultaneously extend types ' YYY

My tsconfig.json is { 'compilerOptions': { 'outDir': './dist/', 'sourceMap': true, 'module': 'es6', 'target': 'es5', 'jsx': 'react', 'allowJs': true, 'preserveConstEnums': true, 'removeComments': true, 'noImplicitAny': false, 'moduleResolution': 'node', 'noUnusedParameters': true }, 'include': [ '....
Kousha

View additional questions