How to force types in Array with TypeScript’s union types
From TypeScript 1.4 we can do nice stuff with types now, with help of feature called Union Types : https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript#union-types which will let you...
View ArticleHow to get type of object in TypeScript, when using union types and type...
tl;dr When checking for primitive types in TypeScript , typeof variable === “string” or typeof variable === “number” should do the job. When checking for HTMLElement or HTMLDivElement type of objects,...
View ArticleIn TypeScript when checking for types at runtime, don’t use type...
tl;dr Type HTMLTableDataCellElement is not defined in Chrome and FireFox, this object is IE only. If you want to test at runtime for TD element in all latest browsers, use HTMLTableCellElement instead....
View ArticleHow to disable building of TypeScript files in Visual Studio 2015
If you would like to disable building TypeScript files in your solution for some reason (you want different build workflow, you just work on .cs files and don’t touch .ts files), you had to search for...
View ArticleHow to exclude some files from TypeScript build
If you are using TypeScript nightly (and only with TypeScript 1.6 up) you can use in your tsconfig.json new property exclude which will mostly be used for node_modules like this (more on this here :...
View ArticleUsing typescript@next nightly package? Don’t rely on –save-dev to be up-to-date!
Just a small update for all you cutting edge TypeScript users. If you are using typescript@next NPM package as showed here :...
View ArticleAsync/Await s TypeScript a Babel – code samples a prednáška
Prednáška : https://docs.google.com/presentation/d/1_Bbe8Fp1pfY2FjcpaaK0-1KjHTwFGwEft0cKpe4H2qU/edit?usp=sharing Sample project : https://github.com/rostacik/codecon2015samples
View ArticleHow to filter particular TypeScript errors in build result
Hi interwebz. I just want to share this short poor man’s fix when migrating TypeScript to filter out some particular errors in TypeScript build. Why the hell you (might) need it? So what would be the...
View ArticleHow to handle async functions inside constructors in TypeScript
In this post we will discuss some options you have with calling async functions in constructor of your TypeScript classes. So, first of all – why would you do this? Well, maybe you need some data from...
View ArticleGulp TypeScript build error : TypeError: Cannot read property ‘length’ of...
At work we use a TS “native” approach with tsconfig.json settings and running tsc compiler approach + gulp-typescript with some tuned building pipelines and some logic. We switched on incremental...
View Article