For several HTML forms, I want to configure inputs and deal with their values. My types have the following structure (you may copy it to TypeScript Playground http://www.typescriptlang.org/play to see it in action): interface InputConfig { readonly i
I know a little about TypeScript which I've learned this month in a university course. Can this denote the empty set? type emptySet=0&1; because when I try to assign this to any value, i.e. (boolean, number, string) I get type error. I'm not sure wha
I'm still quite new at TypeScript, so other SO questions and the documentation sometimes leave me just as confused as I started. I'm going to put this as simply as I can, and if it's a duplicate, please point me to it. I'm essentially wondering what
I am creating a recipe app where I have a search and the user can search by the ingredient. I want the functionality to be when they touch the spacebar to type the next input for it to appear as a label below with a X next to it, therefore deselectin
I have an Ionic 2 app, and I need to know if there is internet connection (in general, any type) and it's not working. If I do: if (Network.connection) { this.af.auth.subscribe(user => { if (user) { this.hasSession = true; } else { this.hasSession =
My App.component which calls a init method in my user service. ngOnInit(){ this.init(true).then(data => { console.log("OnInit Called") }) } User.service returns a promise which in turn calls the account.init init = (isRegistered) => { retu
Is it possible to implement the following interface: export interface Foo { (): void; bar: number; } Using classes? This is the closest thing I could figure out: var foo = function () { } as Foo; foo.bar = 5; Although I'm not completely sure, I think
Im trying to send data from one component to other using observable. Here I'm implementing observable in service like this... import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/RX' @Injectable() export class SelectedItemServ
I am working on a basic Angular2 sample using NodeJS , and the editor i am using is atom. I have npm installed angular2(2.0.0-beta.17) and typescript npm install angular2 npm install -g typescript In my main.ts am importing import { Component } from
I use angular-cli to generate a new project. Now I want to add socketJs to the project, but keep getting errors in browser console: GET http://localhost:4200/url-parse 404 (Not Found) GET http://localhost:4200/inherits 404 (Not Found) Unhandled Promi
How can the attributes be transparently translated from wrapper component to nested component? Considering that there is const FIRST_PARTY_OWN_INPUTS = [...]; const FIRST_PARTY_PASSTHROUGH_INPUTS = ['all', 'attrs', 'are', 'passed']; @Component({ sele
I have a quick question. I'm currently looking through https://angular.io/docs/ts/latest/api/router/Router-class.html but I was wondering, in my Angular2's main.ts I have my routes defined thus: @Routes([ { path: '/', component: HomeComponent }, { pa
I'm using TypeScript with --module system (SystemJS) in a very large project. SystemJS supports cyclic dependencies, and most of the time it works fine. However, when TypeScript inheritance gets involved, things begin to break. For example, if a clas
Trying to retrieve the Json string from localStorage and append a new dish to it. It is not working as it should, can someone please help me. Am using TypeScript. interface Dish { id: number; name: string; desc: string; price: number; }; export class
Why does the following assertion work: interface AllRequired { a: string; b: string; } let all = {a: "foo"} as AllRequired; // No error But this assertion gives an error: interface SomeOptional { a?: string; b: string; } let some = {a: "foo
I am not able to import images in my headercomponent.ts. I suspect it is because of something i am doing wrong while compiling ts(using webpack ts loader) because same thing works with react( where the components are written in es6) The error locatio
Is there any way to have a TypeScript enum compatible with strings from JSON? For example: enum Type { NEW, OLD } interface Thing { type: Type } let thing:Thing = JSON.parse('{"type": "NEW"}'); alert(thing.type == Type.NEW); // false I
This is a sort of continuation of my previous post about nested forms in Angular2 (beta 3 with TS) (Angular2 beta: nesting form-based parent/child components and validating from parent), but I'm posting a new question as it refers to a different type
this is my ts code: import AddToCartBtn from "./AddToCartBtn"; import * as React from "react"; import * as ReactDOM from "react-dom"; declare var document:Document; var _handler : __React.MouseEventHandler; ReactDOM.render(&l
In Angular 2 how do you access a child component class from the parent component class? e.g. import {Component, View} from 'angular2/core'; @Component({selector: 'child'}) @View({template: `...`}) class Child { doSomething() { console.log('something'
I am compiling multiple TypeScript files into a single JavaScript file. Say for example they are called: A.ts // depends on C.ts B.ts // depends on C.ts C.ts When I checked the JavaScript output, I found a problem: TypeScript's __extends function fai
I'm working to update a simple NodeJS + ExpressJS app to use TypeScript. I've got it working, but I'm having fits adding some extra data annotations to add extra type checking and code-time autocomplete/IntelliSense in Visual Studio & WebStorm. I've
I know that there have been other questions on this topic but none of the answers have been particularly helpful and some are out of date so I thought I would ask again. Has anyone had any luck with getting Polymer and Typescript to play nice? It see
I have the following situation. I want to be able to define a static method on a base class (register) which uses references to other static properties, which should be overridden. For example: class Base { constructor() { } public static name = "Ove
I have a superclass A that has a class attribute templateUrl and an instance method f that makes use of the class attribute: class A { public static templateUrl: string = "default.html"; public f() { console.log(A.templateUrl); } } Is there a wa
I've installed TypeScript and Web Essential for Visual Studio 2012. In a new TypeScript Project were created 3 files: default.html app.css app.ts In all tutorials, VS 2012 automatically create dropdown for app.ts file in explorer, where is hidden app
I want to be able to have inline TypeScript in an ASPX (or Razor) page that is converted to Javascript when the page compiles. So: <script type="text/typescript" runat="server"> ... </script> Becomes... <script type=&quo
Resolved: Thank you all for your help. I'm not sure exactly what caused this, but I restarted Visual Studio and everything went back to normal. Not sure why, but it's been working ever since (yesterday). I didn't have these problems last night (with
I downloaded and installed TypeScript extension for VS 2012, I got my first sample compiles by manually dragging the ts file onto the tsc.exe file! because no other way to compile the file will work. I don't want to manually do this everytime I want
I'm working on a definitions file for the Google maps API for TypeScript. And I need to define an enum like type eg. google.maps.Animation which contains two properties: BOUNCE and DROP. How should this be done in TypeScript?TypeScript 0.9+ has a spe