A JavaScript like programming language created by Microsoft. Open source, and compiles to JavaScript.

learn more… | top users | synonyms

3
votes
3answers
175 views

optional data in the constructor, bad practice?

Currently I have a model class that represents a user. This class has a constructor that takes an object with all user properties, used for example, when creating the user. In this case I instantiate ...
1
vote
4answers
167 views

Where should “conversion” functions be placed?

I have a type Bound as a sort of "alias" for an array of three numbers (working in TypeScript with: type Bound = [number, number, number]). I did this basically to help readability by specifying in ...
9
votes
2answers
310 views

What does it mean to inject data (vs behaviour) in a class constructor, and why is that considered bad practice?

I am reading the book "Learning TypeScript" by Remo Jansen. In one section the author describes how to create a very simple proof-of-concept MVC framework including how to create the Model class and ...
1
vote
1answer
69 views

Considerations when using Gulp to compile typescript vs using Visual Studio [closed]

We are a Microsoft shop, developing with Visual Studio. We are building a single page app, and we have elected to use Gulp to handle a lot of the script build tasks (javascript minification, css ...
3
votes
1answer
114 views

I feel like the more I improve the structure of my program I am writing a DSL [closed]

My project started out as spaghetti code. The more DRY and extensible I make my code, the more it looks like configuration files and code than runs them. Is that a good thing or does that mean I am ...
8
votes
2answers
572 views

Unit Testing a stateful framework such as Phaser?

TL;DR I need help in identifying techniques to simplify automated unit testing when working within a stateful framework. Background: I'm currently writing a game in TypeScript and the Phaser ...
1
vote
2answers
84 views

TypeScript/ES2015: Prefer `const` instead of `let` reduces readability?

ES2015 introduced the let and const keywords, which essentially have the same semantics apart from reassignment. (const can be seen as a final variable in languages like Java.) I see the point of ...
4
votes
0answers
302 views

Is there a reasonable way for a typescript class to derive from a dojo/dijit class?

DefinitelyTyped has a dojo solution which uses named modules and may work with legacy dojo and explicit typing, but these declarations do not facilitate typescript import since there are no anonymous ...
0
votes
0answers
41 views

Finding types in TypeScript

I'm using a lot of implicit any in TypeScript. I don't quite understand how to decipher a TSD file in order to get the correct type when building off a library like express or angular. Is there a way ...
1
vote
3answers
159 views

How far should I validate user input in my own created API?

I got something here that bogs my mind a bit. Let's say I write me this API (in TS), check out some of these properties: export class MyAPI{ propertyThatShouldContainSuffix:Array<...
6
votes
2answers
188 views

Idiomatic way to write JavaScript class that maintains state and tells you when that state has changed

I am an experienced C++ developer but new to JavaScript. I want to write an ES6 JavaScript class that maintains state. How do I tell when state has changed? I can think of two ways to do this. One ...
2
votes
0answers
217 views

Why aren't there traditional namespaces in TypeScript? How do I group classes without them?

"Traditional" namespaces in the sense that Java, C#, and PHP use it. Spaces to organize related classes and sub-namespaces that span across multiple files. How do I rewire my brain to think without ...
2
votes
1answer
472 views

Is it a bad practice to compile TypeScript NodeJS app to a single JS file?

I'm currently exploring TypeScript and I was wondering why not compile the whole app to a single JS file instead of compiling every .ts file to it's corresponding .js. Example for such an app is ...
1
vote
0answers
234 views

How do webpack and gulp complement each other?

I've started with TypeScript 2.5 years ago with Visual Studio and ASP.Net MVC. VS Web Essentials would compile ts files on save and the WebOptimizer library would bundle them together at runtime in a ...
1
vote
2answers
334 views

Design pattern for multiple companies in AngularJS

We are on the verge of launching v3 of our in-house product. v2 was written completely in AngularJS and V3 will be the same, but written completely in Typescript. We have a few customers that have ...
1
vote
1answer
1k views

Why doesn't v8 compile typescript instead of javascript? [closed]

Since Typescript is just a superset of javascript (every javascript program is also a typescript program), I've got this idea - why doesn't v8 support typescript? or anything statically typed ...
77
votes
4answers
26k views

Differences between TypeScript and Dart [closed]

Microsoft recently unveiled Typescript, a new JavaScript-like programming language. Some time ago, I heard about Dart, a new programming language created by Google to solve problems related to ...
20
votes
5answers
4k views

What is the motivation behind TypeScript?

We had JavaScript, then we had Flash, then we had Silverlight and then HTML5 ownd them all. So what is the motivation behind TypeScript? What problems are going to be tackled and what improvements ...
4
votes
2answers
1k views

How does authentication work with ASP.NET (using Live ID and\or Windows Authentication)

I'm primarily a .NET desktop app programmer. Coming into the web world has been difficult. I'm trying to convert one of my Silverlight apps into HTML. But I'm having a hard time figuring out the ...
4
votes
1answer
505 views

TypeScript or JavaScript for noob web developer [closed]

Following the recent release by Microsoft of TypeScript I was wondering if this is something that should be considered for a experienced WinForm and XAML developer looking to get into more web ...