Using these definitions:
https://github.com/borisyankov/DefinitelyTyped
So, say, I use angularJS 1.3.14, how to know for sure that there is proper definition for that particular angular version?
Or how to know for sure that DefinitelyTyped *.d.ts file is consistent to its *.js one?
Or If I use older version of AangularJS, how to find proper ts file?
How do I know it is a proper definition?
You use it and see if you come across a bug. Definitely Typed is open source and accepts issues and contributions so it is easy to remedy any errors in the definitions.
In the case of Angular, the large community will typically result in fewer errors in the definitions as many people are already using them.
How do I know the .d.ts is consistent to its .js one?
This is largely the same as above. This is a community endeavour, so there are many people updating type definitions to keep them correct. If you find a problem it is usually simple to solve (the type definition itself usually looks a lot like the API documentation for a library).
If I use an older version of Angular, how do I find the .d.ts file.
You can see the history on GitHub, for example the angular.d.ts history.
You can usually see when the commits go in to update the library versions here.
Related
I'm using WebStorm 2017.1.4 and I have a project which contains both ES5 and ES6 files at the same time. Therefore I want to configure syntax highlighting accordingly, but I'm unable to find how to do it :-(
So, the question is: how to configure JS version per file or, at least, folder?
So, the question is: how to configure JS version per file or, at least, folder?
ATM it's not possible. But such functionality will be available in 2017.3.
In meantime -- have a look at some possible workarounds in corresponding ticket (they might help in rather limited number of cases) -- https://youtrack.jetbrains.com/issue/WEB-12666.
My front end is an Angular 1.x project with tons of files. I basically need to validate it and find any errors that are there in any of the files. Specifically, errors that can break the page. In compiled/static type languages like Java, this is very easy, as the compiler will tell you exactly what's wrong. However, since JS is interpreted/dynamically typed, I can't figure out a way to "build" these files and find errors like I would for compiled languages. Going to every single page in the browser after I make any change is neither practical nor scalable.
I am also not using TypeScript or ES6 and it's not possible at the moment to migrate to any of them. Tools like ESLint and JSHint have also not been very successful, since they only bring out minor errors within that file. However, a lot of major code is spread over several files. Although my code is already all ES5, I thought about concatenating all JS files together in one file and running babel on it. But have it been sure how to manage dependencies during the concatenation (such as in what order to concatenate files).
This cant be the only project that uses vanilla JS and needs to be validated for errors. Anyone has any ideas on how I should go about accomplishing the task?
I highly recommend writing tests using jasmine and karma. I've found the two of these integrate really well with Angular and test driven development is highly regarded as one of the best development styles.
With all of this being said, I understand that's not what you're looking for directly because you want more of a "compiler" like solution. The closest thing that you can get to this in JS in my opinion is a linter and when combined with tests, this solution is rather good at finding errors in JS code.
Does there exist any central place where all Haxe bindings for JS libraries are meant to be stored? Both if I want to find one, or submit one.
Is there some not outdated working tool to generate these bindings from TypeScript definitions?
Is there a binding for nodejs ws library?
http://lib.haxe.org also known as haxelib, the Haxe package manager. Other than that there are also libraries on Github, which you can install with haxelib git libname https://github.com/bla/bla.git
This kinda sounds like all libs are out of date. There is https://github.com/Simn/ts2hx as you might understand it is not a simple task to create such tool since TypeScript is a different (more dynamic) language and has a different type system which doesnt easily translate to haxe externs. In my experience this lib does 90% of the work. Also it isnt hard to create own externs, but I get you expect free direct-use libs. If tool/lib doesnt work please repot or contribute at the lib; Thats how opensource projects work.
I dont know
Hope this helps! Have a nice day!
Besides Haxelib, you can usually find a ton of stuff on GitHub (e.g. by searching for jsrequire <foo> language:haxe or other keywords). There are also some privately curated extern collections like clemos/js-kit, haxe-node-modules, abedev/npm
Simn/ts2hx is the only one that comes to mind
I found some externs, some of them inside other projects/libraries
I'm trying to get WebStorm's JavaScript Library support using DefinitelyTyped TypeScript interface definitions to work as expected (hopefully as intended) in JavaScript.
I've added the library definitions using the Download feature...
I made sure it's in the global scope, too.
Yet I can't seem to reference THREE or any of the other DefinitelyTyped library module definitions.
It's not just undefined inside of JSDoc references, it's undefined everywhere. I know I should have "#type" here instead of "#param", I was just trying to elicit a different result; the results are the same.
What am I doing wrong?
Do I need to create a _references.js as one would for Visual Studio or something?
Restart WebStorm at least twice (possibly four times) after having added the interface definitions. 🤦
This solution applies to WebStorm 2016.2.1
I'm creating a ionic (cordova) product and I'd like to utilize typescript and its benefits for autocompletion optimally. But since many of the plugin objects don't stem from concrete classes I don't know how/if there is a way to utilize the knowledge from the plugin files (which are .js). If there is a way to do this I'd of course like to know this.
As mentioned in my comment you can use Typescript definition files to provide type information.
There are definition files for common Cordova plugins on Definitly Typed.
If you can't find type information for the plugin you're looking for, you can write your own definition file.
If there is a way to do this I'd of course like to know this.
Yes. Just add allowJS to true in the tsconfig.json compilerOptions. Your IDE should magically start working with .js files ;)
More
Give http://alm.tools/ a go. I wrote it with such workflows in mind 🌹